elcoo Posted November 15, 2012 Share Posted November 15, 2012 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. Quote Link to comment Share on other sites More sharing options...
Andy Gilbert Posted November 15, 2012 Share Posted November 15, 2012 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 Quote 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 More sharing options...
elcoo Posted November 15, 2012 Author Share Posted November 15, 2012 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 Quote Link to comment Share on other sites More sharing options...
elcoo Posted November 16, 2012 Author Share Posted November 16, 2012 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 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? Quote Link to comment Share on other sites More sharing options...
macklebee Posted November 16, 2012 Share Posted November 16, 2012 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... Quote 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 More sharing options...
elcoo Posted November 16, 2012 Author Share Posted November 16, 2012 well there you go, elcoo... i hope that helps... Sorry for being so immodest, but no, no it doesn't help a bit Quote Link to comment Share on other sites More sharing options...
elcoo Posted November 17, 2012 Author Share Posted November 17, 2012 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. Quote Link to comment Share on other sites More sharing options...
elcoo Posted December 13, 2012 Author Share Posted December 13, 2012 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.