Many people have been wondering how on earth me and Danaby made the F35 Fighter Jet takeoff vertically and how I made the Rocket Car propell itself 10 times its normal speed, all by pressing CTRL. This guide will explain what the heck I’m talking about and how do do similar stuff yourself. At the bottom of this psot there is also a Unitypackage link for the Rocket Car.
If you haven’t seen them:
Mine and Danaby’s F35
My Rocket Car
The force effect was created with …well as the title suggests, constant force. (TL:DR for experienced Unity users at the bottom)
https://imgur.com/FNpHFAo Constant force is a component that makes a Unity gameobject get propelled on any axis you like, kind of like a jet motor.
How I made the constant force affect the vehicle while pressing CTRL, was made by parenting a gameobject with the constant force component to the Sirens prefab, a gameobject that only activates when CTRL is pressed, making it ideal for toggleable force.
https://imgur.com/03kEFvM (Protip, don’t name them/it Siren #, as that will animate them/it and make the force jerk)
“But Diesel, how do I make the Vehicle follow these gameobjects?” Easy, give each of the gameobject(s) with constant force a fixed joint component, with the Vehicle as connected body.
Important: Don’t give the Vehicle itself a fixed joint, only the gameobject(s)
Taa-Taa! You now have a fully functioning Vehicle that gains extra force in some directions! Remember to have the same hierarchy for a Clip, except replacing the connected body with Clip itself, and to tag everything with Vehicle.
Tips and Tricks:
To stabilize the force, you can have more 4 or more force gameobjects evenly spaced out to not make it all focused on one point.
To achieve a vertical jet takeoff effect, give a small global force upwards on the component and a small one on the local. This will make the vehicle go upwards, but still be controlable by tilting the vehicle with the keyboard/mouse.
You can give the gameobject(s) particle effects, for things like sparks coming out from a vehicle nitro or afterburners for aircrafts taking off.
To check how the vehicle will react to the forces once in Unturned, you can simply play the set-up scene in Unity! Remember to temporarily uncheck “Is Kinematic” on the Vehicle gameobject and check “Use Gravity” when testing in Unity, and to remove the Clip as it will collide with the Vehicle and glitch it out.
TL:DR for the ones experienced with Unity: Parent objects with constant force to the Sirens gameobject set on any axis. Tag/layer them Vehicle and give them a fixed joint connected to the main body (Vehicle). Set Clip’s Siren gameobject with the same hierarchy, but connect the children’s joints to Clip instead of Vehicle.
That’s basically all I feel like I have to explain, DM me spelling errors/inconsistencies if there are any and I’ll correct and edit this post.
Thanks to @danaby2 for the Jet mod.
Unity Package file example of the Rocket Car: http://www.mediafire.com/file/e5zom4fzm4ryd05/Constant_Force_Vehicles.unitypackage