BodyPosition
Applies a force to maintain a constant position.
Memory category | Instances |
---|
Member index 9
Description
The BodyPosition object applies a force on a BasePart such that it will maintain a constant position in the world. The Position property, not to be confused with BasePart.Position, controls the target world position. This is the translational counterpart to a BodyGyro. If you need further control on a force applied to an object, consider using a BodyForce or BodyThrust instead.
The strength of the force applied by this object is controlled by several factors, namely the distance to the goal position: the force is stronger when farther away from the goal. This is amplified by P (power). The present velocity will also dampen the force applied by this object, and this is amplified by D (dampening). The resulting force is then capped by MaxForce. Note the force applied on the part to achieve the goal position may vary on a per-axis basis.
History 39
- 553 Change PreferredDescriptor of lastForce from to GetLastForce
- 553 Change PreferredDescriptor of position from to Position
- 553 Change Default of position from to Vector3(0, 50, 0)
- 553 Change PreferredDescriptor of maxForce from to MaxForce
- 553 Change Default of maxForce from to Vector3(4000, 4000, 4000)
- 553 Change Default of Position from to Vector3(0, 50, 0)
- 553 Change Default of P from to 10000
- 553 Change Default of MaxForce from to Vector3(4000, 4000, 4000)
- 553 Change Default of D from to 1250
- 553 Change PreferredDescriptor of BodyPosition from to AlignPosition
- 516 Change Tags of BodyPosition from [] to [Deprecated]
- 486 Change ThreadSafety of position from ReadOnly to ReadSafe
- 486 Change ThreadSafety of maxForce from ReadOnly to ReadSafe
- 486 Change ThreadSafety of Position from ReadOnly to ReadSafe
- 486 Change ThreadSafety of P from ReadOnly to ReadSafe
- 486 Change ThreadSafety of MaxForce from ReadOnly to ReadSafe
- 486 Change ThreadSafety of D from ReadOnly to ReadSafe
- 462 Change ThreadSafety of ReachedTarget from to Unsafe
- 462 Change ThreadSafety of lastForce from to Unsafe
- 462 Change ThreadSafety of GetLastForce from to Unsafe
- 462 Change ThreadSafety of position from to ReadOnly
- 462 Change ThreadSafety of maxForce from to ReadOnly
- 462 Change ThreadSafety of Position from to ReadOnly
- 462 Change ThreadSafety of P from to ReadOnly
- 462 Change ThreadSafety of MaxForce from to ReadOnly
- 462 Change ThreadSafety of D from to ReadOnly
- 210 Change Tags of lastForce from [] to [Deprecated]
- 210 Change Tags of position from [NotReplicated] to [NotReplicated, Deprecated]
- 210 Change Tags of maxForce from [NotReplicated] to [NotReplicated, Deprecated]
- 210 Add Position
- 210 Add MaxForce
- 113 Add ReachedTarget
- 47 Add lastForce
- 47 Add GetLastForce
- 47 Add position
- 47 Add maxForce
- 47 Add P
- 47 Add D
- 47 Add BodyPosition
Members 9
D
Type | Default | |
---|---|---|
float | 1250 |
The D property determines how much dampening will be applied to the force used toward reaching the goal Position. When the part approaches the goal position it needs to decelerate, otherwise it will move 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 position.
Thread safety | ReadSafe |
---|---|
Category | Goals |
Loaded/Saved | true |
GetLastForce
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
Vector3 |
This function returns the last force in the object.
Thread safety | Unsafe |
---|
History 2
- 462 Change ThreadSafety of GetLastForce from to Unsafe
- 47 Add GetLastForce
MaxForce
Type | Default | |
---|---|---|
Vector3 | 4000, 4000, 4000 |
The MaxForce property determines the limit on the amount of force that may be applied on each axis in reaching the goal Position. If a part isn't moving, consider increasing this value (also check that it is not Anchored or attached to any anchored parts).
Thread safety | ReadSafe |
---|---|
Category | Goals |
Loaded/Saved | true |
P
Type | Default | |
---|---|---|
float | 10000 |
The P property determines how much power is used while applying force in order to reach the goal Position. The higher this value, the more power will be used and the faster it will be used. The force the BodyPosition exerts increases as the difference between the part's current position and the goal position increases. This property is multiplied to this force to either amplify or diminish it.
Thread safety | ReadSafe |
---|---|
Category | Goals |
Loaded/Saved | true |
Position
Type | Default | |
---|---|---|
Vector3 | 0, 50, 0 |
The Position property determines the goal position towards which the BodyPosition will apply force.
Thread safety | ReadSafe |
---|---|
Category | Goals |
Loaded/Saved | true |
ReachedTarget
Parameters (0) | ||
---|---|---|
No parameters. |
Fired when the Parent of the BodyPosition reaches the desired BodyPosition.Position (within .1 studs). Once this event fires it will not fire again until BodyPosition.Position is updated.
Thread safety | Unsafe |
---|
History 2
- 462 Change ThreadSafety of ReachedTarget from to Unsafe
- 113 Add ReachedTarget
lastForce
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
Vector3 |
The lastForce function returns the last force in the object.
Thread safety | Unsafe |
---|
maxForce
Type | Default | |
---|---|---|
Vector3 | 4000, 4000, 4000 |
Thread safety | ReadSafe |
---|---|
Category | Goals |
Loaded/Saved | true/false |
History 6
- 553 Change PreferredDescriptor of maxForce from to MaxForce
- 553 Change Default of maxForce from to Vector3(4000, 4000, 4000)
- 486 Change ThreadSafety of maxForce from ReadOnly to ReadSafe
- 462 Change ThreadSafety of maxForce from to ReadOnly
- 210 Change Tags of maxForce from [NotReplicated] to [NotReplicated, Deprecated]
- 47 Add maxForce
position
Type | Default | |
---|---|---|
Vector3 | 0, 50, 0 |
Thread safety | ReadSafe |
---|---|
Category | Goals |
Loaded/Saved | true/false |
History 6
- 553 Change PreferredDescriptor of position from to Position
- 553 Change Default of position from to Vector3(0, 50, 0)
- 486 Change ThreadSafety of position from ReadOnly to ReadSafe
- 462 Change ThreadSafety of position from to ReadOnly
- 210 Change Tags of position from [NotReplicated] to [NotReplicated, Deprecated]
- 47 Add position