Andy Gilbert Posted December 9, 2009 Share Posted December 9, 2009 Hi.. does anyone know why the Vector will not stay local in this command? mesh1:AddForceAtPoint(TFormVector(Vec3(0,Force,0),null,mesh1),TFormPoint(Vec3(0,0,2),null,mesh1)) It starts fine, but as soon as it turns on a different axis, its clear the force is not acting relative any more. 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...
TylerH Posted December 9, 2009 Share Posted December 9, 2009 I assume you want it local relative the mesh1 entity? Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
Andy Gilbert Posted December 9, 2009 Author Share Posted December 9, 2009 Hi tyler, yes thats right, i want to add a force at a point on my model, thats allways relative in position and rotation of the model, mesh1. 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...
TylerH Posted December 9, 2009 Share Posted December 9, 2009 It may be messing up if that is a mesh and not a model. Try using it on the parent of mesh1. (Passing mesh1.parent or whatever to the TForm... functions) Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
Andy Gilbert Posted December 10, 2009 Author Share Posted December 10, 2009 It may be messing up if that is a mesh and not a model. Try using it on the parent of mesh1. (Passing mesh1.parent or whatever to the TForm... functions) Doesnt seem to be that ,so this is still unknown... I have tried it on mesh's, bodies? Just cant seem to get it to work? 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...
Josh Posted December 11, 2009 Share Posted December 11, 2009 mesh1:AddForceAtPoint(TFormVector(Vec3(0,Force,0),null,mesh1),TFormPoint(Vec3(0,0,2),null,mesh1)) 1. You can't add forces to a mesh, only a body or a model. 2. Is Force a float value or a Vec3 itself? 3. In Lua you use nil, not null. 4. AddForceAtPoint is global, so I am not sure why you are transforming the point and force to local space to begin with. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Andy Gilbert Posted December 11, 2009 Author Share Posted December 11, 2009 Hi Josh.. Ok ill answer the easiest. 1.You can't add forces to a mesh, only a body or a model. I know that, and i am adding to a body, it was just a name i was using. 2.Is Force a float value or a Vec3 itself? Im not to sure what you mean by that, but basically i have a variable which is a float that im using as my force in a Vec3. 3.In Lua you use nil, not null. Ok, ill change that, it compiles fine so i didnt know any other. 4.AddForceAtPoint is global, so I am not sure why you are transforming the point and force to local space to begin with. My originally question may answer that ( But basically because i want them local, not global) Hi.. does anyone know why the Vector will not stay local in this command? mesh1:AddForceAtPoint(TFormVector(Vec3(0,Force,0),null,mesh1),TFormPoint(Vec3(0,0,2),null,mesh1)) It starts fine, but as soon as it turns on a different axis, its clear the force is not acting relative any more. Thanks Andy All, i want to do is add a force at a point on a body, and that force and position of it stay LOCAL to the body. 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...
TylerH Posted December 11, 2009 Share Posted December 11, 2009 Oh! Since AddForceAtPoint is a global function, and the force and such you are adding is Local, you need to transform from the body's local space into global space. Switch nil and mesh1 positioning in the Transform command so mesh1 is first and nil is second, which should work properly Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- 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.