Jump to content

AddForce applied always to direction of car (or ship)


YouGroove
 Share

Recommended Posts

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.

Stop toying and make games

Link to comment
Share on other sites

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

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

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...