Phys2d Velocity Problem... Body Movement from Point A to B with Velocity.

I am trying to write a code in Phys2d in which an object(BOX) is supposed to be moved from location A to location B with the Velocity of 2 m/s in certain direction let suppose North.

I’m new to this game programming specially physics & I don’t know how should i have to set the velocity…I just read in few demos (they wern’t even clear )

following is the code but box is not moving, do I need to apply force as well??

… new Box(“Truck”,10.0f, 10.0f, 100.0f);
Truck.setPosition(262, 184);
Truck.setPaint(Color.blue);
Truck.adjustVelocity(new Vector2f(0f, -35f));
World.add(Truck);

any help will be highly appreciated…

You’re going to have to post a LOT more code than that for us to help you quickly.

Thanks for your reply…

I made a mistake by defining object as static after declaring it as dynamic Code is working fine… the box is moving with certain velocity in upward direction because of (negative) velocity and falls down due to gravity… Still i m wondering how should I move Box from Location (x,y) to Location2(x,y)… Is there any way to have a look of sky view because here things fall from top to bottom??? any help??

As ClickerMonkey allready said, it would be very helpfull to post some more code here and maybe next time use the code tags: [.code][./code] (without the dots :)). Its just much more readable.

I didn’t work with Phys2d nor Slick but maybe you have to adjust the gravity or set it directly to 0, try:


world.setGravity(0,0)

This way your box should move without beeing affected by gravity :).