Hey DevForum, I’m trying to create a rocket which can be controlled by the player. I want it to fly towards the direction the player is looking, but I am not familiar with velocity and constraints and I have little to no experience in creating vehicles so I am not sure how to go about this. I have researched constraints and velocity for the last 3-4 hours and looked on many websites and devforum posts, but I still can’t tackle it. Any help on this would be greatly appreciated.
the camera will be attached to the rocket to simulate as if the player is the rocket.
I would like to be able to make this compatible with mobile and console
You can probably create the rocket, so when the rocket spawns in, set the Camera to scriptable then set the CFrame of the camera to the rocket, after that you might be able to make the rocket follow the mouse with CFrame.lookAt(), the rocket will look at the mouse, and will change the Camera Angle
BodyForce would give you a realistic rocket acceleration, but wouldn’t really give it a max velocity. It would just keep going faster. If you use BodyVelocity, you would have to do the math in some loop on the go. How “Controllable” are we talking about?
This is more than you could put together here. Hard to give you a script without knowing many things. So, I looked around a bit and with a few modifications this should get you at least going. I’m not sure if I can add links here, so you’ll have to find this yourself with a Google search or YouTube search. The title of the video is: “How to Make a Homing Missile Launcher - Roblox Studio ” That should put you 90% there and with a script you can post for help if needed. The video comes with resources in the show more…
And for this part, use the lookat bit again, and apply that to the velocity property of a bodyvelocity, you can at the start make it slow, then as it gets faster just multiple a bigger number until it reaches the max speed you want.
You can also try using the new constraint object version, but I don’t have a clue how to use them, so you would need to read up on the docs
I’ve tried using linearvelocity as I’d like the velocity to be constant, but I’m not sure how to make the velocity be applied forward, it always seems to push the rocket sideways, regardless of rotating the attachment. Probably a noob mistake but I am unfamiliar with bodyforces in ROBLOX Studio so I wouldn’t be surprised.