Sweetgebus Posted November 14, 2022 Posted November 14, 2022 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. Quote
Thirsty Panther Posted November 14, 2022 Posted November 14, 2022 Setinput should solve your problems. https://www.leadwerks.com/learn?page=API-Reference_Object_Entity_SetInput Quote
Sweetgebus Posted November 14, 2022 Author Posted November 14, 2022 1 hour ago, Thirsty Panther said: Setinput should solve your problems. https://www.leadwerks.com/learn?page=API-Reference_Object_Entity_SetInput Thank you, I'll give this a shot. 1 Quote
Alienhead Posted November 16, 2022 Posted November 16, 2022 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) 1 Quote Alienhead Components and Software
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.