Jump to content

AddForce in Camera direction


Sweetgebus
 Share

Recommended Posts

Hello, new to leadwerks. I've been scratching my head trying to figure out had to addforce to an object in the direction of the camera. I've started out with leadwerks just attempting little things as people usually do. Right now I've got a gokart that I've been able to get moving, but the problem is when it turns, the direction of travel does not. I've utilized the Addforce command but cannot seem to figure out how to make it follow the direction the camera is pointing at the time.  I'm scripting lua, and anything help would be appreciated.

Link to comment
Share on other sites

I think I know exactly what your wanting to do.  This will set the object to the angle of the camera, and start it moving.. Change it to fit you needs.

        force = Vec3(35, 0, -7000)
        local v = Transform:Vector(force, camera, nil)
        bullet:AddForce(v.x, v.y, v.z)
        bullet:SetVelocity(0,5,0)

  • Upvote 1
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...