# [ODE] retrieving the final movement force

This topic is 3892 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi all, I want to test out if a body (in my case a unit) is moving. Therefore I'd like to get the final movement force (the force the body is actually moving). Because a body is also influenced by collisions, dBodyGetLinearVel is not sufficient. I need this force to find out if a body is moving at the moment. I also need this force to compute the orientation (the orientation retrieved by dBodyGetQuaternion is not the one i need). My question now: Is there a way to get this force? [Edited by - unsigned short on March 18, 2008 8:35:46 AM]

##### Share on other sites
This is one great force which you speak of.

But the only force I can think of is F, which is equal to MA. In order to have a force, you need an acceleration (or a change in mass 0_0 ). Acceleration is change in velocity over change in time. So if you get the linear velocity one frame, and subtract that from the linear velocity at the next frame, and divide by the time that has passed, you'll get A. Multiply this by M to get F.

To test if a body is moving you check it's velocity.
To check if a body is accelerating you take the derivitive of the velocity.

These concepts can be directly applied to angular motion as well.

If that dosnt answer your question you're going to need to be more specific and use the proper terms. I suggest getting a physics school book.

##### Share on other sites
Quote:
 Original post by bzroomThis is one great force which you speak of.But the only force I can think of is F, which is equal to MA. In order to have a force, you need an acceleration (or a change in mass 0_0 ). Acceleration is change in velocity over change in time. So if you get the linear velocity one frame, and subtract that from the linear velocity at the next frame, and divide by the time that has passed, you'll get A. Multiply this by M to get F.To test if a body is moving you check it's velocity.To check if a body is accelerating you take the derivitive of the velocity.These concepts can be directly applied to angular motion as well.If that dosnt answer your question you're going to need to be more specific and use the proper terms. I suggest getting a physics school book.

Hm yeah but the problem is that not only the linear velocity is taken into account but also all the forces resulting from collisions (don't know how to get them). What I want is the velocity vector which the body is actually moving, meaning the one I see when I look at the screen.

##### Share on other sites
So you want the linear velocity in screen space? So take ssV = Screen * Projection * View * V...

I dont think you know what you want, but i'm pretty sure what you want is linear velocity. If you keep track of your last velocity, and compare it before and after collisions, you can determine exactly how much "force" was applied by the collision.

i have to give props here, it seems like almost everything i comment about i learned from emeyex (bzroom thinks back to VfromCollision)

##### Share on other sites
Hm as far as I know dBodyGetLinearVel returns only what is set by dBodySetLinearVel. But the actual velocity is also influenced by other forces, for example from collisions. I tested this out. Even if all forces cancel each other out, meaning the object is not moving on the screen, the linear vel is still the one I set with dBodySetLinearVel.

##### Share on other sites
You know what, I think I just experienced this actually. I'm going to test it out and see if you're right.

edit: Sorry, I'm sure dBodySetLinearVel and dBodyGetLinearVel work correctly. I dropped a body from a few meters and monitored its velocity. It accelerated and camed to rest as expected. I then set the velocity of the body upward and away for 2 seconds, ever frame, then stopped. The velocity went from being nearly fixed to accelerating downward and came to rest as expected.

Is there any chance that you're calling dBodyGetLinearVel before you step the simulation? If so then that explains why you always get the same value back.

[Edited by - bzroom on March 19, 2008 12:42:40 AM]

##### Share on other sites
Thank you very much, that was EXACTLY the problem!!! Works great :D

1. 1
2. 2
Rutin
18
3. 3
4. 4
5. 5

• 9
• 9
• 9
• 14
• 12
• ### Forum Statistics

• Total Topics
633300
• Total Posts
3011266
• ### Who's Online (See full list)

There are no registered users currently online

×