Reference API Roblox

Engine API

Website

Related

Reference API Roblox

BodyPosition

Applies a force to maintain a constant position.

This class is deprecated. It exists only for backward compatibility, and should not be used for new work.
Tags: [Deprecated]

Member index 9

HistoryMember
726D: float
726MaxForce: Vector3
726P: float
726Position: Vector3
726maxForce: Vector3
726position: Vector3
462GetLastForce(): Vector3
726lastForce(): Vector3
462ReachedTarget()
inherited from Instance
726Archivable: bool
726Capabilities: SecurityCapabilities
726IsInSandbox: bool
726Name: string
726Parent: Instance
726PredictionMode: PredictionMode
726Sandboxed: bool
726UniqueId: UniqueId
576AddTag(tag: string): null
573ClearAllChildren(): null
462Clone(): Instance
573Destroy(): null
486FindFirstAncestor(name: string): Instance
486FindFirstAncestorOfClass(className: string): Instance
486FindFirstAncestorWhichIsA(className: string): Instance
486FindFirstChild(name: string, recursive: bool = false): Instance
486FindFirstChildOfClass(className: string): Instance
486FindFirstChildWhichIsA(className: string, recursive: bool = false): Instance
486FindFirstDescendant(name: string): Instance
563GetActor(): Actor
486GetAttribute(attribute: string): Variant
462GetAttributeChangedSignal(attribute: string): RBXScriptSignal
631GetAttributes(): Dictionary
648GetChildren(): Instances
462GetDebugId(scopeLength: int = 4): string
707GetDescendants(): Instances
486GetFullName(): string
706GetStyled(name: string, selector: string?): Variant
657GetStyledPropertyChangedSignal(property: string): RBXScriptSignal
576GetTags(): Array
576HasTag(tag: string): bool
486IsAncestorOf(descendant: Instance): bool
486IsDescendantOf(ancestor: Instance): bool
664IsPropertyModified(property: string): bool
698QueryDescendants(selector: string): Instances
573Remove(): null
576RemoveTag(tag: string): null
664ResetPropertyToDefault(property: string): null
573SetAttribute(attribute: string, value: Variant): null
462WaitForChild(childName: string, timeOut: double): Instance
726children(): Instances
726clone(): Instance
726destroy(): null
726findFirstChild(name: string, recursive: bool = false): Instance
726getChildren(): Instances
726isDescendantOf(ancestor: Instance): bool
726remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
657StyledPropertiesChanged()
726childAdded(child: Instance)
inherited from Object
726ClassName: string
726className: string
647GetPropertyChangedSignal(property: string): RBXScriptSignal
647IsA(className: string): bool
726isA(className: string): bool
647Changed(property: string)

Description

The BodyPosition object applies a force on an assembly 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 assembly to achieve the goal position may vary on a per-axis basis.

History 49

Members 9

D

TypeDefault
float

This property determines how much dampening will be applied to the force used toward reaching the goal Position. When the assembly 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 an undesirable "rubber‑banding" effect, avoided by applying dampening. The higher this value is set, the greater the dampening curve becomes, or the slower the assembly will approach the goal position.

History 5

  • 726 Change Default of D from 1250 to
  • 553 Change Default of D from to 1250
  • 486 Change ThreadSafety of D from ReadOnly to ReadSafe
  • 462 Change ThreadSafety of D from to ReadOnly
  • 47 Add D

GetLastForce

Parameters (0)
No parameters.
Returns (1)
Vector3

This function returns the last force in the object.

History 2

MaxForce

TypeDefault
Vector3

This property determines the limit on the amount of force that may be applied on each axis in reaching the goal Position. If an assembly isn't moving, consider increasing this value and also check that it is not Anchored or attached to any anchored assemblies.

History 5

P

TypeDefault
float

This 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 assembly's current position and the goal position increases. This property is multiplied to this force to either amplify or diminish it.

History 5

  • 726 Change Default of P from 10000 to
  • 553 Change Default of P from to 10000
  • 486 Change ThreadSafety of P from ReadOnly to ReadSafe
  • 462 Change ThreadSafety of P from to ReadOnly
  • 47 Add P

Position

TypeDefault
Vector3

This property determines the goal position towards which the BodyPosition will apply force.

History 5

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.

History 2

lastForce

Parameters (0)
No parameters.
Returns (1)
Vector3

The lastForce function returns the last force in the object.

This function is deprecated. It exists only for backward compatibility, and should not be used for new work.

History 5

Tags: [Deprecated]

maxForce

TypeDefault
Vector3
This property is deprecated. It exists only for backward compatibility, and should not be used for new work.
This property is not replicated. Its interface does not cross the network boundary.

History 8

Tags: [NotReplicated, Deprecated]

position

TypeDefault
Vector3
This property is deprecated. It exists only for backward compatibility, and should not be used for new work.
This property is not replicated. Its interface does not cross the network boundary.

History 8

Tags: [NotReplicated, Deprecated]

Settings