I currently got a collision listener added in Add. How can I check if this object has a certain name?
I need to make sure it is one of two object types. I already checked the event variable, but that had no clear name.
Current code:
add: (world, component) => {
const {eid, dataAttribute} = component
const checkCollision = ((e) => {
const data = dataAttribute.cursor(eid)
// Get collision name
const name = 'Left'
if (name === 'Left') {
data.correctCount++
}
console.log(e)
})
world.events.addListener(component.eid, ecs.physics.COLLISION_START_EVENT, checkCollision)
// Runs when the component is added to the world.
},