Adding DetectorVolume capabilities to Entity class
Posted: Thu Apr 05, 2012 9:48 pm
Hi Norbo,
first of all, thanks for the great engine.
Now to my question:
I'd like to be able to subscribe to some collision events to update my logic. An Entity's CollisionInformation gives me InitialCollisionDetected and CollisionEnded (which, to my understanding, should be equal to DetectorVolume's EntityBeginsTouching and EntityStopsTouching). How could the Entity fire events like DetectorVolume's VolumeBeginsContainingEntity and VolumeStopsContainingEntity?
My first guess was to use both, an Entity and a DetectorVolume for the same game object. In that case, after what I've read here in the forums, I'd have to update the DetectorVolume's position through its TransformableMeshData and call TriangleMesh.Tree.Refit. But I wonder if this is really the best approach.
Would it be better to subclass my Entity/MobileMesh and extend it with the DetectorVolume capabilities in some way? Is the Entity's CollisionInformation sufficient to provide me with everything I need to mimic VolumeBeginsContainingEntity and VolumeStopsContainingEntity and write custom methods like "EntityBeginsContainingEntity" and "VolumeStopsContainingEntity"?
Using only DetectorVolumes might not be an option, since I want to be able to apply impulses to my game objects (and still get notificatons if one is completely contained in another one).
Thanks in advance.
first of all, thanks for the great engine.
Now to my question:
I'd like to be able to subscribe to some collision events to update my logic. An Entity's CollisionInformation gives me InitialCollisionDetected and CollisionEnded (which, to my understanding, should be equal to DetectorVolume's EntityBeginsTouching and EntityStopsTouching). How could the Entity fire events like DetectorVolume's VolumeBeginsContainingEntity and VolumeStopsContainingEntity?
My first guess was to use both, an Entity and a DetectorVolume for the same game object. In that case, after what I've read here in the forums, I'd have to update the DetectorVolume's position through its TransformableMeshData and call TriangleMesh.Tree.Refit. But I wonder if this is really the best approach.
Would it be better to subclass my Entity/MobileMesh and extend it with the DetectorVolume capabilities in some way? Is the Entity's CollisionInformation sufficient to provide me with everything I need to mimic VolumeBeginsContainingEntity and VolumeStopsContainingEntity and write custom methods like "EntityBeginsContainingEntity" and "VolumeStopsContainingEntity"?
Using only DetectorVolumes might not be an option, since I want to be able to apply impulses to my game objects (and still get notificatons if one is completely contained in another one).
Thanks in advance.