Seperate position and velocity iteration

jimjim
edited July 2013 in General discussions
Afaik, orx uses same value for both position and velocity iteration. I have found most of the places and even in the box2d manual that position iteration is always smaller, around half of velocity iteration. In box2d manual
The suggested iteration count for Box2D is 8 for velocity and 3 for position.
Though setting this value is just an upper limit and box2d might use less iteration if it founds a good solution, but there can be a small performance gain with lesser position iteration. I think it wont be much of a problem to use separate value for each of them. More info on iteration can be found here
http://www.iforce2d.net/b2dtut/worlds

Comments

  • edited July 2013
    Hi jim,

    Orx uses only one value for the solver iteration number as it's how most of the physics engine work (at least the most common used in gamedev: physx, havok, bullet, ...).

    Box2D is thus kind of an exception here and I'd rather stick with the majority when designing a plugin code/config interface, that's why I didn't add two separate values for iterations.

    That being said, I can make sure that the position iteration number is half the speed one instead of being the same value, I have no problem with that. :)
  • jimjim
    edited July 2013
    Yeah, now I can see box2d is the exception, well for 2D extreme precision is not required, so half would be enough. Although, I can just make that half in the source and build box2d plugin for my own purpose.
  • edited July 2013
    If it's supposed to be a good practice, I might as well put it in orx, I just didn't know at the time I wrote that plugin. :)
  • edited July 2013
    And it's done! :)
  • jimjim
    edited July 2013
    Most of the places I have found used less position iteration (box2d), its not a very big deal. I did not know most of the 3D engine uses same iteration value, otherwise I might not ask the separation.

    edit: oh, thanks :)
Sign In or Register to comment.