deltaluca

Untitled

Apr 12th, 2013
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Haxe 0.75 KB | None | 0 0
  1. // going to use this to control horizontal velocity of player
  2. var playerController = new Body(BodyType.STATIC);
  3. playerController.space = space;
  4.  
  5. // LineJoint is used to match the playerController horizontal kinematicVel to the players horizontal velocity.
  6. // we set stiff = false and maxError = 0 to disable the positional part of the constraint
  7. // and so the anchors really don't matter (hence just set to (0,0) here)
  8. var playerJoint = new LineJoint(playerController, player, Vec2.weak(), Vec2.weak(), Vec2.weak(0,1), Math.NEGATIVE_INFINITY, Math.POSITIVE_INFINITY);
  9. playerJoint.stiff = false;
  10. playerJoint.maxError = 0;
  11. playerJoint.space = space;
  12.  
  13. ...
  14.  
  15. before calling space.step()
  16. playerController.kinematicVel.x = whateverXVelocityYouWouldLikePlayerToHave;
Advertisement
Add Comment
Please, Sign In to add comment