YouGroove Posted July 12, 2013 Share Posted July 12, 2013 Ok , the game i plan is not character and pathfinding based , but physic based. Arcade futurist race game , space ships game etc ... I have a cube i know how to add a force. But instead of putting a force always in the same direction, i would like to apply the force always on the direction the cube (car) is facing. getRotation() ? How to use that vector for the AddForce() function ? Anyone have already tried that ? ************** This is what is lacking : High level functions of that style, some other engine have libraries ready to use with functions to call that such stuff. Would be good to make some for Leadwerks 3. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Andy Gilbert Posted July 12, 2013 Share Posted July 12, 2013 Simply adding the force to the cube (car) using AddForce in local coordinates will do this. I have a very simple car setup using forces and drag, but if you simply want to apply a force and keep its rotation then do what your doing alredy apply a force but not global. To turn the cube use addTorque. Don't use turn or rotate. You cannot mix physics with normal positioning. AddForce(x,y,z) so use z for example. Then Make it so when left or right key is down you AddTorque(0,val,0) 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...
YouGroove Posted July 12, 2013 Author Share Posted July 12, 2013 Thanks Andy. I just had like you said to use local instead of global. I will just have to figure how ot keep camera aligned to cube direction ? i should find some code on 3rd person tutorials. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Andy Gilbert Posted July 13, 2013 Share Posted July 13, 2013 Just parent the camera to the cube and give it an offset. Andy 1 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...
Admin Posted July 15, 2013 Share Posted July 15, 2013 Pass false in the last optional global parameter: http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/entity/entityaddforce-r156 1 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.