RocketPropulsion

Show Deprecated
deprecated

The RocketPropulsion object applies a force on a part so that it both follows and faces a target part. It acts like a hybrid of BodyPosition and BodyGyro. Unlike other BodyMovers, a RocketPropulsion must be instructed to begin applying a force: call Fire to start, or call Abort to stop.

You can detect when the part reaches its target using the ReachedTarget event, which fires once the part is within the TargetRadius of the Target.

RocketPropulsion has the most physics-related properties out of all the BodyMovers. It is helpful to separate the properties out into categories based on what they control:

Remember, you don't need to use both the translational and rotational force features of a RocketPropulsion: by setting MaxThrust to 0, you can make a part just face the target without having it follow the target around (consider also using a BodyPosition in addition). Similarly, by setting MaxTorque to (0, 0, 0), you can have a part simply follow another object without facing it (use a BodyGyro if you want the object to maintain a specific orientation).

Summary

Properties

  • read parallel

    Determines the tendency of the part to face the Target.

  • read parallel

    Determines the maximum speed at which the part will move toward the Target.

  • read parallel

    Determines the maximum amount of thrust that will be exerted to move the part.

  • read parallel

    Determines the maximum amount of torque that may be exerted to rotate the part towards the Target.

  • read parallel

    Determines the object towards which the part should follow/face.

  • read parallel

    Determines the world offset from the Target toward which the force/torque is exerted.

  • read parallel

    Determines the maximum distance from the Target the part must be in order for ReachedTarget to be fired.

  • read parallel

    Determines the dampening applied to the part in order to prevent it from overshooting the Target.

  • read parallel

    Determines how aggressive of a force is applied in reaching the Target.

  • read parallel

    Determines the amount of dampening that to use in reaching the Target.

  • read parallel

    Determines how aggressive of a torque is applied in facing the Target.

Methods

  • Abort():void

    Causes the Rocket to stop moving towards its target, making it fall.

  • Fire():void

    Causes the rocket to fly towards Target.

Events

  • 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.

Properties

CartoonFactor

read parallel

The CartoonFactor property determines the tendency of the part to face the Target. By default, this property is set to 0.7. If set to 0, the part will make no effort to face the target.

MaxSpeed

read parallel

The MaxSpeed property determines the upper limit of the velocity at which the part will move toward the Target. A RocketPropulsion will apply a force to decelerate a part if it exceeds this speed limit.

MaxThrust

read parallel

The MaxThrust property determines the upper limit of the thrust that may be exerted to move the part. Parts or assemblies that have high mass will require more thrust in order to remain airborne, and thus track the Target.

MaxTorque

read parallel

The MaxTorque property determines the upper limit on the amount of torque that may be exerted in order to rotate the part towards the Target. It functions similarly to BodyGyro.MaxTorque.

Target

read parallel

The Target property determines the object towards which the RocketPropulsion will exert force/torque. If set to nil, the TargetOffset will be used instead.

TargetOffset

read parallel

The TargetOffset property determines the world offset from the Target. Basically, it makes the RocketPropulsion behave as if the target were really offset by this property. It is especially useful when Target is set to nil, since this property then acts as the target position.

TargetRadius

read parallel

The TargetRadius property determines the maximum distance from the RocketPropulsion.Target the part must be in order for the RocketPropulsion.ReachedTarget event to be fired. It does not affect the exerted forces in any way.

ThrustD

read parallel

The D property is used to dampen the velocity of the part in order to prevent it from overshooting the Target and causing a rubber-banding effect. It behaves similarly to BodyPosition.D.

ThrustP

read parallel

The P property determines how much power is used while applying force in order to reach the Target position. The higher this value, the more power will be used and the faster it will be used. This property works similarly to BodyPosition.P.

TurnD

read parallel

The D property is how much dampening will be applied to the torque used to face the Target. When the part approaches the goal orientation it needs to decelerate, otherwise it will rotate past the goal and have to stop and re-accelerate back toward the goal. This is often creates undesirable rubber-banding effect, so applying dampening using this property is how that effect is avoided. The higher this value is set, the greater the dampening curve becomes, or the slower the part will approach the goal orientation.

TurnP

read parallel

The P property determines how much power is used while applying torque in order to face the Target. The higher this value, the more power will be used and the faster it will be used.

Methods

Abort

void

Causes the Rocket to stop moving towards its target, making it fall.


Returns

void

Fire

void

Causes the rocket to fly towards Target.


Returns

void

Events

ReachedTarget

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.