Deprecated code snippets

Discuss issues specific the Java port of Box2D
ThinSkin
Posts: 2
Joined: Tue Jun 07, 2016 5:59 pm

Deprecated code snippets

Postby ThinSkin » Tue Jun 07, 2016 6:04 pm

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));

Return to “Java”



Who is online

Users browsing this forum: No registered users and 4 guests