Jump to content

ForceAtPoint vs Force


elcoo
 Share

Recommended Posts

Hi there,

am I right when I say the following two lines should do the same to the affected body? (Center of mass is at point zero)

 

 

AddBodyForce(p.hullBody,Vec3(0,GetBodyVelocity(p.hullBody,0).Y,0)*-1000,0);

AddBodyForceAtPoint(p.hullBody,TFormVector(Vec3(0,GetBodyVelocity(p.hullBody,0).Y,0)*-1000,p.hullBody,NULL),EntityPosition(p.hullBody));

 

Because they seem to behave different. I'm trying to use AddBodyForceAtPoint as shown above in a plane simulation but as soon as I use it the plane doesn't seem to have as much lift as it had with AddBodyForce. If I just turn up the force It starts behaving jerky and jittery. Using AddBodyForce works just fine but I need to ajust the point where the force is added for a more precise simulation.

Link to comment
Share on other sites

Hi elcoo, although i dont have the direct answer I have done many many attempts at flight simulator dynamics with leadwerks. Whilst i found it difficult, I did learn alot and realised (got told :) ) to get more precise physics like you are trying you need to calculate the forces differently.

 

You may already be doing this as ive not seen your code, but you need to calculate the forces apply at different points of your model (so each wing, tail, etc...) and also the drag and then calcualte the total force acting on the plane and apply that single force.

 

I was trying all sorts with using AddBodyForceAtPoint and others but never had any luck, until i finally got my head around it. I think if you search there will be a few post of mine regardin this same issue, aswell as many conversation with julio on the newton game dynamics forum.

 

Although ive not had time to pursue this, this is the last "glider" style dynamics i achive in leadwerks.

 

 

Thanks

Andy

The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do.

 

Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d

Link to comment
Share on other sites

Hi Andy,

I already am calculating the forces for each important point of the aircraft at the specific positions. This works good for the ruders, but not for the main wings, which have to deal with bigger forces. I think the reason could be, that the point I apply the force at might be somewhat behind the actual position of the body. I have to figure that out with callbacks I guess.

Cool video you got there btw.. The flight dynamics look very believable! I'm gonna read through some of your posts, maybe I'll find some useful tips :D

Link to comment
Share on other sites

Found a dirty fix for the problem: The force was indeed applied at wrong positions as the physics interpolation wouldn't let me know where the body really is, it just showed me the visualized position. So a friend of mine told me to try and put this line:

PositionEntity(p->hullBody,EntityPosition(p->hullBody,1),1);

Between UpdateFramework() and RenderFramework(). Even though this call seems redundant and it's dirtier than Woodstock '94, it fixed the problem and my plane flies just like I wanted it too. Might post a vid of it soon.

If you got any cleaner fix for this though, let me know smile.png

 

EDIT: As I already suspected, this fix causes some other major problems, especially if the Framerate drops or rises. So what I need is a way to get the exact position of the body. Not the position of the mesh, nor the interpolated position of the physical body. I need to get the raw position of the body, the one that is shown to me in wireframe when I activate debugphysics. How can I get this?

Link to comment
Share on other sites

Sometimes, the adenoids in children may swell and, in these cases, your doctor may suggest removal of the adenoids (adenoidectomy) to avoid disorders such as breathing problems and difficulty in breathing.

well there you go, elcoo... i hope that helps...

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Doing some further enquiries I saw that it's possible to use the newton game dynamics commands directly. But how do you get the pointer to the newton objects? As far as I know attributes of the type TBody only are references to the Leadwerks entities. I'm using C++ btw.

Link to comment
Share on other sites

  • 4 weeks later...

I got on experimenting with some other stuff in the meantime, but now I'm stuck again with the same problem. Can it really be that there is no way to get the true current position of a body? I worked with physics engines before and I see multiple scenarios were it would be essential to get the real position of a body and not a interpolated one. For example networking, limited movement etc.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...