Say I have a simple game with a gameLoop function that gets called every 50 milliseconds or something similar, and I have a box2d object. Is it bad practice/too CPU intensive to use SetLinearVelocity on the object every time the gameLoop is called?
Tell me more
×
Game Development Stack Exchange is a question and answer site for
professional and independent game developers. It's 100% free, no registration required.
|
|
||||
|
|
|
It's only bad if you find this to be detrimental to the performance of your game. I find it unlikely that setting the velocity directly would be very expensive. If you do find that this is an issue, by profiling the code, you can create a simple function that only updates the box2D object's velocity if your external velocity value has changed. Something like:
|
|||||||||
|