GBX.lua.RocketPropulsion (Object)
From Goodblox Wiki
Jump to navigationJump to search
Preliminary: This item was still under development in this version of Roblox. Use only for experimental work.
The RocketPropulsion object is used to apply force to a Part or other object in a similiar manner as a rocket (ie. towards a given part, with given thrust and torque).
Functions
In addition to the Global functions, RocketPropulsion incorporates the following:
Properties
In addition to the Global properties, the BodyForce also has these:
- CartoonFactor - In a nutshell, the tilt of the rocket as it flies. A value of 0 will make the rocket's nose point upwards. A value of 1 will make the rocket's nose point straight towards the Target. CartoonFactor must lie between 0 and 1.
- MaxSpeed - The maximum speed that the rocket will travel at
- MaxThrust - The maximum thrust the rocket will exert. Heavy rockets need more thrust to remain airborne and to track the target.
- MaxTorque - The maximum torque the rocket will use to rotate itself.
- Target - What Part the object will fly towards.
- TargetOffset
- TargetRadius - The radius of the Target before the ReachedTarget event is fired.
- ThrustD - The D in the PD controller that governs the motion of the Rocket. Dampens the motion of the Rocket, preventing it from overshooting.
- ThrustP - The P in the PD controller that governs the motion of the Rocket. The higher the number, the more aggressively the rocket will move towards the Target.
- TurnD - The D in the PD controller that governs the rotation of the Rocket. Dampens the rotation of the Rocket, preventing it from overshooting.
- TurnP - The P in the PD controller that governs the rotation of the Rocket. The higher the number, the more aggressively the rocket will turn towards the Target. [1]
Events
- ReachedTarget - This event is fired when the Rocket comes within TargetRadius of the target. (This is used to make the rocket work, such as make an explosion when it flies near the Target.)
Example Script
Insert this script into a small, unanchored part, and change the name in the script:
local rocket = script.Parent local rp = Instance.new("RocketPropulsion") rp.Parent = rocket rp.Target = game.Players.YourNameHere.Character.Torso rp:Fire()