Problem with ApplyForce

General discussion about Box2D tutorials
Post Reply
Daboog
Posts: 22
Joined: Tue Jan 15, 2013 4:38 pm

Problem with ApplyForce

Post by Daboog »

Hello, I need help!
I am loaded rube scene in world and create body 'rocket'... but when I use method ApplyForce, object is goes on. If I exchange to ApplyImpulse, rocket is soars. Could you ask me, why ApplyForce dont work?

This is link to test project http://winafterwin.com/test/rockets/
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Problem with ApplyForce

Post by iforce2d »

The box2d forums might be a better place for this: http://box2d.org/forum/

How does that test project work, do I need to push a key or something? I'm not sure what you mean by 'goes on', and why that is bad...
Daboog
Posts: 22
Joined: Tue Jan 15, 2013 4:38 pm

Re: Problem with ApplyForce

Post by Daboog »

Sorry, this is my inadvertence. After every step I clear all forces "ClearForces()", thats why object dont move...
Daboog
Posts: 22
Joined: Tue Jan 15, 2013 4:38 pm

Re: Problem with ApplyForce

Post by Daboog »

Iforce, could you tell me, why is rocket behaves poorly when I load in rube world? I had а simulator rocket http://winafterwin.com/test/rockets2/, you can control rocket by arrow keys. But, when I load rocket in Rube world, she behaves like a feather... I am check mass of rocket and it is the same and forces same.

this is link to rocket rube:
http://winafterwin.com/test/rockets/
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Problem with ApplyForce

Post by iforce2d »

Hey that looks pretty cool! Really looks like a rocket :)

I don't know about your question though... are you using the same time step length (editor uses 60fps by default). I'm not exactly sure what you mean by 'like a feather' - I imagine something fluttering and tumbling while it falls, but probably you mean something different.
Daboog
Posts: 22
Joined: Tue Jan 15, 2013 4:38 pm

Re: Problem with ApplyForce

Post by Daboog »

After some tests I guess that this is because of new version Box2d 2.1 ... The first version rocket was created by Box2d 2.0, but I dont know, why such a difference :?:
Daboog
Posts: 22
Joined: Tue Jan 15, 2013 4:38 pm

Re: Problem with ApplyForce

Post by Daboog »

http://winafterwin.com/test/rockets2/ This is on 2.1 version and I reduced the forces and torque of 10, but rocket not realistic
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Problem with ApplyForce

Post by iforce2d »

It seems like the thrust is always pushing the rocket upwards, when it should be going in the opposite direction to the smoke particles, right? As far as I can tell, the particles are always going in the right direction, so how about just using the reverse of that direction for the thrust force.
Daboog
Posts: 22
Joined: Tue Jan 15, 2013 4:38 pm

Re: Problem with ApplyForce

Post by Daboog »

Problem solved by method ClearForces() before each step. Thanks for debate Iforce :)
Post Reply