[collision detection]Having two collision handlers

is it possible to have two or more collision handlers for the same from object? for example PhysicsCollisionHandler and EventCollisionHandler
i tried but this doesn’t work

No, but you don’t need to, because a PhysicsCollisionHandler is an EventCollisionHandler. The magic of inheritance.


Imagine that i have my player on a height map terrain, he’ll need a CollisionHandler Floor to stay on it. How can i control collision betwen the object and the other objects?

(Just a sidenote, if it’s a height map terrain a CollisionHandlerFloor is overkill. You can position your player’s Z by using getElevation on the terrain or by reading the height values from the heightmap image.)

If you really do want two different kinds of CollisionHandlers for a particular object, then create two different kinds of collision solids to attach them to.

In particular, a CollisionHandlerFloor requires a CollisionRay. On the other hand, a CollisionHandlerPusher requires a CollisionSphere. You can’t hook them both up to the same kind of object anyway. But you can create both a ray and a sphere and attach them both to your character.


Alternatively, iirc, you may be able to set up a single handler with a formatted event name (see the manual) and parse out the from and/or into objects to differentiate types of collision within the handler. E.g. one handler handles all events, but checks the event name and does something different for “mob-into-guy” than “floor-into-guy”.