This project is read-only.

Move physic object

Sep 12, 2012 at 4:18 PM

How i can move a physic object or change the size in the code? For example to control a player by the keyboard?

Sep 12, 2012 at 4:34 PM

To move a physics object, you need to ApplyForce.

PhysicsSprite spr = cnvGame.PhysicsObjects["ball"];
spr.BodyObject.ApplyForce(new Vector2(xVel, yVel));

if you need your sprite to not rotate, you can use Fixed Rotation:

spr.BodyObject.FixedRotation = true;

Resizing (scaling) an object is a bit involved. I have done it for my app (demo here -

... but I have not yet created a function in Physics Helper for it.

Sep 12, 2012 at 7:48 PM

Thanks that helps me a lot