And they solved it through timer, it will probably work, but only for 1 “bullet”, but I can spawn multiple “bullets” at one time and here is problem… How can I define what bullet to rotate through timer after collision?
Not sure what you are trying to accomplish exactly. Perhaps you’re fighting the physics engine? if the object is rotating as the result of a bullet striking it (or other way around), then make sure the angular velocity and mass for each object is set correctly.
Also during a collision, you can get the ID of each object involved in the collision. The object ID could be saved and handled in the right timeframe.
You are understand right, I need to rotate bullet on collision to right direction… I have function how to do this, but I cant apply it to the right bullet …
How can I save id of bullet during collision? And what if 2 bullets will collide in the same time?
Try wrapping everything into a timer, even with just a 1ms delay. Sometimes that helps when you need to wait for an event to be resolved. [import]uid: 52430 topic_id: 17433 reply_id: 66136[/import]
What Jon said. You need to delay the execution of the rotation by even 1ms as box2d can’t manipulate things whilst it is doing a calculation at the exact same time. The unnoticeable delay solves this issue [import]uid: 84637 topic_id: 17433 reply_id: 66360[/import]
Im not sure if I understand right. Still can’t get it work :(. Can you post some example piece of code?
Thanks. [import]uid: 59968 topic_id: 17433 reply_id: 69860[/import]