Set Position of multiple bodies
- by philipp
I have a character composed of five bodies which are tied together by a lot of joints. On of them is the overall chassis, to which all forces and impulses are applied to move the whole Character.
All in all that works very fine, except one thing: I need to set the Position of the Character so that it get Beamed from one place to the other in one single frame.
Unfortunately I cannot get this to work. I tried the following code, without any success…
playerbodies.forEach(function (bd) {
bd.SetLinearVelocity(new b2.Vec2());
var t = bd.GetTransform();
t.p.x -= 10;
bd.SetTransform(t, bd.GetAngle());
});
How can I make that happen?