RBX.lua.RocketPropulsion (Object): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Mindraker
No edit summary
>Mindraker
more defs, source
Line 6: Line 6:
In addition to the Global functions, RocketPropulsion incorporates the following:
In addition to the Global functions, RocketPropulsion incorporates the following:


*[[Abort (Function)|Abort()]]  - Makes the rocket fall.
*[[Abort (Function)|Abort()]]  - Causes the rocket to fall down
*[[Fire (Function)|Fire()]]  - Makes the rocket fly.
*[[Fire (Function)|Fire()]]  - causes the rocket to fly towards Target


==Properties==
==Properties==
In addition to the Global properties, the BodyForce also has these:
In addition to the Global properties, the BodyForce also has these:


*[[CartoonFactor (Property)|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 (Property)|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 (Property)|MaxSpeed]] - How fast the rocket will fly.
*[[MaxSpeed (Property)|MaxSpeed]] - The maximum speed that the rocket will travel at
*[[MaxThrust (Property)|MaxThrust]] - The amount of thrust that is exerted on the rocket, used to keep heavier rockets airborne.
*[[MaxThrust (Property)|MaxThrust]] - The maximum thrust the rocket will exert. Heavy rockets need more thrust to remain airborne and to track the target.
*[[MaxTorque (Property)|MaxTorque]] - The maximum amount of force that is used to turn the rocket.
*[[MaxTorque (Property)|MaxTorque]] - The maximum torque the rocket will use to rotate itself.
*[[Target (Property)|Target]] - What [[Part]] the object will fly towards.
*[[Target (Property)|Target]] - What [[Part]] the object will fly towards.
*[[TargetOffset (Property)|TargetOffset]]
*[[TargetOffset (Property)|TargetOffset]]
*[[TargetRadius (Property)|TargetRadius]] - The radius of the Target before the [[ReachedTarget (Event)|ReachedTarget event]] is fired.
*[[TargetRadius (Property)|TargetRadius]] - The radius of the Target before the [[ReachedTarget (Event)|ReachedTarget event]] is fired.
*[[ThrustD (Property)|ThrustD]]
*[[ThrustD (Property)|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 (Property)|ThrustP]]
*[[ThrustP (Property)|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 (Property)|TurnD]]
*[[TurnD (Property)|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 (Property)|TurnP]]
*[[TurnP (Property)|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. [http://blog.roblox.com/?p=142]


== Events ==
== Events ==
*[[ReachedTarget (Event)|ReachedTarget]] - The event that is fire when the rocket flies within the desired TargetRadius.  (This is used to make the rocket work, such as make an explosion when it flies near the Target.)
*[[ReachedTarget (Event)|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.)





Revision as of 15:22, 6 October 2008

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:

  • Abort() - Causes the rocket to fall down
  • Fire() - causes the rocket to fly towards Target

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()