Page 1 of 1

Deprecated code snippets

Posted: Tue Jun 07, 2016 6:04 pm
by ThinSkin
Hello,

I found this code snippet and it seems to be deprecated:

Code: Select all

leftWheel.GetXForm().R.col2.Copy();


and

Code: Select all

sidewaysAxis.Multiply(b2Math.b2Dot(velocity,sidewaysAxis));


Is there a way to do this with the latest version of Box2D?

Thanks,
Julian

EDIT: I found a solution:

Code: Select all

leftWheel.GetXForm().R.col2.Copy();

is pretty much the same as

Code: Select all

double angle = leftWheel.getTransform().getRotation();
float vX = (float)Math.cos(angle);
float vY = (float)Math.sin(angle);
Vector2 ldirection = new Vector2(vX, vY); //This vector is R.col2


and

Code: Select all

sidewaysAxis.scl(velocity.x * sidewaysAxis.x + velocity.y * sidewaysAxis.y);


instead of

Code: Select all

sidewaysAxis.Multiply(b2Math.b2Dot(velocity,sidewaysAxis));