Reference API Roblox

Engine API

Website

Related

Reference API Roblox

BodyGyro

Applies a torque to maintain a constant orientation.

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

Member index 6

HistoryMember
553CFrame: CFrame
553D: float
553MaxTorque: Vector3
553P: float
553cframe: CFrame
553maxTorque: Vector3
inherited from Instance
553Archivable: bool
635Capabilities: SecurityCapabilities
553Name: string
553Parent: Instance
635Sandboxed: bool
616UniqueId: 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
486GetChildren(): Objects
462GetDebugId(scopeLength: int = 4): string
486GetDescendants(): Array
486GetFullName(): string
641GetStyled(name: string): Variant
576GetTags(): Array
576HasTag(tag: string): bool
486IsAncestorOf(descendant: Instance): bool
486IsDescendantOf(ancestor: Instance): bool
580IsPropertyModified(name: string): bool
573Remove(): null
576RemoveTag(tag: string): null
580ResetPropertyToDefault(name: string): null
573SetAttribute(attribute: string, value: Variant): null
462WaitForChild(childName: string, timeOut: double): Instance
553children(): Objects
553clone(): Instance
573destroy(): null
553findFirstChild(name: string, recursive: bool = false): Instance
553getChildren(): Objects
553isDescendantOf(ancestor: Instance): bool
573remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
553childAdded(child: Instance)
inherited from Object
647ClassName: string
647className: string
647GetPropertyChangedSignal(property: string): RBXScriptSignal
647IsA(className: string): bool
647isA(className: string): bool
647Changed(property: string)

Description

The BodyGyro object applies a torque (rotational force) on a BasePart such that it maintains a constant angular displacement, or orientation. This allows for the creation of parts that point in a certain direction, as if a real gyroscope were acting upon it. Essentially, it's the rotational counterpart to a BodyPosition.

If you would like to maintain a constant angular velocity, use a BodyAngularVelocity instead.

The CFrame property controls the goal orientation. Only the angular components of the CFrame are used; position will make no difference. MaxTorque limits the amount of angular force that may be applied, P controls the power used in achieving the goal orientation, and D controls dampening behavior.

History 31

Members 6

CFrame

TypeDefault
CFrame

The CFrame property (not to be confused with BasePart.CFrame) determines the target orientation towards which torque will be exerted. Since BodyGyro does not apply translational force, the translational/positional component of the CFrame, CFrame.p, is ignored. Consider using one of the following CFrame constructors in setting this property: CFrame.fromAxisAngle(), CFrame.fromEulerAnglesXYZ() or CFrame.fromEulerAnglesYXZ(). Beware of gimbal lock as you choose which of these methods and what angles (in radians). Additionally, you could use CFrame.new(gyro.Parent.Position, targetPosition) in order to have the BodyGyro "look at" a targetPosition (Vector3).

History 4

D

TypeDefault
float500

The D property is how much dampening will be applied to the torque used to reach the goal CFrame. 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.

History 4

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

MaxTorque

TypeDefault
Vector3400000, 0, 400000

The MaxTorque property determines the limit on the amount of torque that may be applied on each axis in reaching the goal orientation (CFrame). If a part isn't moving, consider increasing this value (also check that it is not Anchored or attached to any anchored parts).

History 4

P

TypeDefault
float3000

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

History 4

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

cframe

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

History 6

  • 553 Change PreferredDescriptor of cframe from to CFrame
  • 553 Change Default of cframe from to
  • 486 Change ThreadSafety of cframe from ReadOnly to ReadSafe
  • 462 Change ThreadSafety of cframe from to ReadOnly
  • 210 Change Tags of cframe from [NotReplicated] to [NotReplicated, Deprecated]
  • 47 Add cframe
Tags: [NotReplicated, Deprecated]

maxTorque

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

History 6

Tags: [NotReplicated, Deprecated]

Settings