Hi,
I'm trying to hook up some collision events for detecting when a Wheel begins and ends a collision. I believe have hooked up the events correctly (in the same way as our vehicles collision that's working) - But the events are failing to be be fired? Just wanted to ask if there is anything different/deprecated etc with the Wheel events (As I think it's a class that's not really a key feature of the library anymore?)
I know there is the hasSupport bool but I really don't want to be pulling another ~1000 calls per second on the (currently 16) wheels and would rather only calculate which/how many wheels are grounded when a wheel collision is first created.
[EDIT] Just been looking at the Shape Detector, looks like it uses the NoBroadPhase CollisionRule - I imagine this is the problem here. Is there a way to modify these rules?
[EDIT 2] I'm playing about now with the CollisionRules of the Wheel, although this will solve the issue, it is clear you have set the wheel to not use standard rules. is this for performance?
Thanks
aCallum
Collision events for Wheels
Re: Collision events for Wheels
The detector's only job is to provide a proxy AABB which is tested against nearby objects' AABBs. It never computes any contacts since the detector is just a box that contains the wheel's query representation.Just wanted to ask if there is anything different/deprecated etc with the Wheel events (As I think it's a class that's not really a key feature of the library anymore?)
(This is indeed a bit old- a more modern approach would either just use a query directly against the broad phase or use a special dedicated BroadPhaseEntry unencumbered by the Entity class.)
If it is any solace, wheel events would just be doing the same kind of polling at some level if they existed.I know there is the hasSupport bool but I really don't want to be pulling another ~1000 calls per second on the (currently 16) wheels and would rather only calculate which/how many wheels are grounded when a wheel collision is first created.
For reference, the NoBroadPhase rule is just for the vehicle body. The personal NoNarrowPhaseUpdate rule is the one stopping it from generating contacts with other objects.[EDIT] Just been looking at the Shape Detector, looks like it uses the NoBroadPhase CollisionRule - I imagine this is the problem here. Is there a way to modify these rules?
While you could modify them, it wouldn't help since that would just fire events based on contacts created with the detector's box. It would also be much slower than checking if the wheel is supported.
Re: Collision events for Wheels
To clarify, the wheel's shape is defined by a query- a ConvexCast or a RayCast, for example- and not the detector entity itself. The detector is just built to contain the query and to collect the objects to be tested by the query.[EDIT 2] I'm playing about now with the CollisionRules of the Wheel, although this will solve the issue, it is clear you have set the wheel to not use standard rules. is this for performance?
Re: Collision events for Wheels
Thanks for clearing that up - I suspected that the engine would still be doing the polling but I think I got deluded by unnecessary optimisation!