Hi,
Can you attach sensors to dynamic bodies? I tried to attach a sensor to the front of a top down car, and all my forward motion dissapeared - which was working before I attached the sensor type fixturedefs?
Regards
i
Yes, you should be able to do this. If solid fixtures have non-zero density, you can give the sensor fixture a zero density. Then it will not affect the motion.
Thanks, but it doesnt work.
When its a sensor the car cant seem to turn any more.
Regards
i
Don't set the density of the sensor to zero. Things without density don't turn at all.
You can have a body with multiple fixtures. Some fixtures be sensors while some can be solid. A dynamic body just needs one fixture with non-zero density, the rest can be zero. It is up to you to decide how to distribute the mass.
Hi,
I am not using multiple fixtures per body. They are all separate bodies.
I have a car, all separate dynamic bodies with mass (i.e. not multiple fixtures per body). 2 front wheels attached to the car body with revolute joints, two rear wheels attached with prismatic joints. It all works beautifully until I attach a sensor to the body. Regardless of whether the sensor has density or not, the whole car stops responding to steering.
If what you are saying is, it's OK to create a body of multiple fixtures and one be a sensor...this is not my situation.
Regards
i
So if you don't set the sensor flag, your system works correctly? That would be likely be a bug in Box2D.
Yes, look at the two you tube videos, until I attach the sensor via prismatic - it works fine.