Skip to content

Get Sansar

Script API

RigidBodyComponent

Where: Client
More page actions

For the complete documentation index, see llms.txt. This page is also available as Markdown.

The RigidBodyComponent handles interactions with rigid body physics.

public class RigidBodyComponent : Sansar.Script.InstanceInterface

Members at a glance

KindMembers
FieldsComponentType
PropertiesComponentId · Name
MethodsAddAngularImpulse · AddLinearImpulse · GetAngularDamping · GetAngularVelocity · GetBounce · GetCanGrab · GetCenterOfMass · GetColliderCenter · GetColliderExtents · GetDynamicFriction · GetGravityFactor · GetHeldObjectInfo · GetInverseInertia · GetLinearDamping · GetLinearVelocity · GetMass · GetMotionType · GetOrientation · GetPosition · GetSitObjectInfo · GetStaticFriction · IsDynamic · IsTriggerVolume · ReleaseHeldObject · SetAngularDamping · SetAngularVelocity · SetBounce · SetCanGrab · SetCenterOfMass · SetDynamicFriction · SetGravityFactor · SetInverseInertia · SetLinearDamping · SetLinearVelocity · SetMass · SetMotionType · SetOrientation · SetPosition · SetStaticFriction · Subscribe · SubscribeToHeldObject · SubscribeToSitObject · ToString

Fields

ComponentType

public static readonly ComponentType ComponentType

The RigidBodyComponent.ComponentType of this component

Properties

ComponentId

public Sansar.Script.ComponentId ComponentId { get; }

Retrieves the component id for this RigidBodyComponent.

Value: Sansar.Script.ComponentId — The id.

Name

Added in 33.2.0
public string Name { get; }

This RigidBodyComponent name, as specified in the editor.

Methods

AddAngularImpulse

public void AddAngularImpulse(Sansar.Vector impulse)

Adds an angular impulse to this RigidBodyComponent.

ParameterTypeDescription
impulseSansar.VectorThe impulse.
Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

Deprecated
[System.Obsolete("Deprecated. Use the Action<> overload", false)] public ulong AddAngularImpulse(     Sansar.Vector impulse,     Sansar.Script.ScriptBase.OperationComplete handler )

Adds an angular impulse to this RigidBodyComponent.

ParameterTypeDescription
impulseSansar.VectorThe impulse.
handlerSansar.Script.ScriptBase.OperationCompleteHandler to be called when the event completes.

Returns: ulong — The return value is an internal event id.

Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

public void AddAngularImpulse(     Sansar.Vector impulse,     Action<Sansar.Script.OperationCompleteEvent> handler )

Adds an angular impulse to this RigidBodyComponent.

ParameterTypeDescription
impulseSansar.VectorThe impulse.
handlerAction<Sansar.Script.OperationCompleteEvent>Handler to be called when the event completes.
Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

AddLinearImpulse

public void AddLinearImpulse(Sansar.Vector impulse)

Adds a linear impulse the the center of mass of this RigidBodyComponent.

ParameterTypeDescription
impulseSansar.VectorThe impulse.
Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

Deprecated
[System.Obsolete("Deprecated. Use the Action<> overload", false)] public ulong AddLinearImpulse(     Sansar.Vector impulse,     Sansar.Script.ScriptBase.OperationComplete handler )

Adds a linear impulse the the center of mass of this RigidBodyComponent.

ParameterTypeDescription
impulseSansar.VectorThe impulse.
handlerSansar.Script.ScriptBase.OperationCompleteHandler to be called when the event completes.

Returns: ulong — The return value is an internal event id.

Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

public void AddLinearImpulse(     Sansar.Vector impulse,     Action<Sansar.Script.OperationCompleteEvent> handler )

Adds a linear impulse the the center of mass of this RigidBodyComponent.

ParameterTypeDescription
impulseSansar.VectorThe impulse.
handlerAction<Sansar.Script.OperationCompleteEvent>Handler to be called when the event completes.
Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

GetAngularDamping

public float GetAngularDamping()

Retrieves the amount of damping applied to this object’s angular motion.

Returns: float — The angular damping factor.

GetAngularVelocity

public Sansar.Vector GetAngularVelocity()

Retrieves the angular velocity for this RigidBodyComponent.

Returns: Sansar.Vector — The velocity.

GetBounce

public float GetBounce()

Retrieves the bounce of this RigidBodyComponent.

Returns: float — The bounce factor.

GetCanGrab

public bool GetCanGrab()

The can grab state for this RigidBodyComponent.

Returns: bool — A bool indicating if the object can be picked up.

GetCenterOfMass

public Sansar.Vector GetCenterOfMass()

Retrieves the center of mass of this object in local space.

Returns: Sansar.Vector — A Vector to the center of mass of this object, in the objects local space.

GetColliderCenter

public Sansar.Vector GetColliderCenter()

Retrieves the center of the collision shape for this object in local space.

Returns: Sansar.Vector — The center of the collision shape.

GetColliderExtents

public Sansar.Vector GetColliderExtents()

Retrieves the extents of the collision shape for this object in local space.

Returns: Sansar.Vector — The extents of the collision shape.

GetDynamicFriction

public float GetDynamicFriction()

Retrieves the dynamic friction of this RigidBodyComponent.

Returns: float — The dynamic friction.

GetGravityFactor

public float GetGravityFactor()

Retrieves what factor of the world’s gravity is applied to this object.

Returns: float — The gravity factor.

GetHeldObjectInfo

public HeldObjectInfo GetHeldObjectInfo()

Data about who is holding this RigidBodyComponent.

Returns: HeldObjectInfo — A HeldObjectInfo struct.

GetInverseInertia

public Sansar.Vector GetInverseInertia()

Retrieves the moment of inertia for this object.

Returns: Sansar.Vector — A Vector representation of the inverse moment of inertia.

GetLinearDamping

public float GetLinearDamping()

Retrieves the amount of damping applied to this object’s linear motion.

Returns: float — The linear damping factor.

GetLinearVelocity

public Sansar.Vector GetLinearVelocity()

Retrieves the linear velocity for this RigidBodyComponent.

Returns: Sansar.Vector — The velocity.

GetMass

public float GetMass()

Retrieves the mass of this RigidBodyComponent.

Returns: float — The mass.

GetMotionType

public RigidBodyMotionType GetMotionType()

The motion type for this RigidBodyComponent.

Returns: RigidBodyMotionType — A RigidBodyMotionType enum for the motion type.

GetOrientation

public Sansar.Quaternion GetOrientation()

Retrieves the orientation of this RigidBodyComponent.

Returns: Sansar.Quaternion — The orientation.

GetPosition

public Sansar.Vector GetPosition()

Retrieves the position of this RigidBodyComponent.

Returns: Sansar.Vector — The position.

GetSitObjectInfo

public SitObjectInfo[] GetSitObjectInfo()

Data about who is sitting on this RigidBodyComponent.

Returns: SitObjectInfo[] — A SitObjectInfo struct.

GetStaticFriction

public float GetStaticFriction()

Retrieves the static friction of this RigidBodyComponent.

Returns: float — The static friction.

IsDynamic

Deprecated
[System.Obsolete("Use GetMotionType()", false)] public bool IsDynamic()

Whether this rigidbody is dynamic.

Returns: bool — True if this is a dynamic object.

Remarks

Deprecated. Use GetMotionType() instead.

IsTriggerVolume

public bool IsTriggerVolume()

Whether this RigidBodyComponent is a TriggerVolume.

Returns: bool — True if this RigidBodyComponent is a TriggerVolume.

Remarks

TriggerVolumes can be moved through and generate CollisionEventType.cTrigger collision events instead of normal collision events.

ReleaseHeldObject

public void ReleaseHeldObject()

Force any agent holding this object to drop it.

Added in 32.0.0
public void ReleaseHeldObject(     Action<Sansar.Script.OperationCompleteEvent> handler )

Force any agent holding this object to drop it.

ParameterTypeDescription
handlerAction<Sansar.Script.OperationCompleteEvent>Handler to be called when the event completes.

SetAngularDamping

public void SetAngularDamping(float angularDamping)

Sets the amount of damping to apply to this object’s angular motion.

ParameterTypeDescription
angularDampingfloatThe angular damping factor. Default value is 0.
Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

Deprecated
[System.Obsolete("Deprecated. Use the Action<> overload", false)] public ulong SetAngularDamping(     float angularDamping,     Sansar.Script.ScriptBase.OperationComplete handler )

Sets the amount of damping to apply to this object’s angular motion.

ParameterTypeDescription
angularDampingfloatThe angular damping factor. Default value is 0.
handlerSansar.Script.ScriptBase.OperationCompleteHandler to be called when the event completes.

Returns: ulong — The return value is an internal event id.

Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

public void SetAngularDamping(     float angularDamping,     Action<Sansar.Script.OperationCompleteEvent> handler )

Sets the amount of damping to apply to this object’s angular motion.

ParameterTypeDescription
angularDampingfloatThe angular damping factor. Default value is 0.
handlerAction<Sansar.Script.OperationCompleteEvent>Handler to be called when the event completes.
Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

SetAngularVelocity

public void SetAngularVelocity(Sansar.Vector velocity)

Sets the angular velocity for this RigidBodyComponent. Angular velocity is clamped between -100m/s and 100m/s.

ParameterTypeDescription
velocitySansar.VectorThe velocity.
Remarks

This asynchronous method queues the write then returns. Subsequent calls to RigidBodyComponent.GetAngularVelocity will return the previous velocity until the write occurs. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

Deprecated
[System.Obsolete("Deprecated. Use the Action<> overload", false)] public ulong SetAngularVelocity(     Sansar.Vector velocity,     Sansar.Script.ScriptBase.OperationComplete handler )

Sets the angular velocity for this RigidBodyComponent.

ParameterTypeDescription
velocitySansar.VectorThe velocity.
handlerSansar.Script.ScriptBase.OperationCompleteHandler to be called when the event completes.

Returns: ulong — The return value is an internal event id.

Remarks

This asynchronous method queues the write then returns. Subsequent calls to RigidBodyComponent.GetAngularVelocity will return the previous velocity until the write occurs. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

public void SetAngularVelocity(     Sansar.Vector velocity,     Action<Sansar.Script.OperationCompleteEvent> handler )

Sets the angular velocity for this RigidBodyComponent. Angular velocity is clamped between -100m/s and 100m/s.

ParameterTypeDescription
velocitySansar.VectorThe velocity.
handlerAction<Sansar.Script.OperationCompleteEvent>Handler to be called when the event completes.
Remarks

This asynchronous method queues the write then returns. Subsequent calls to RigidBodyComponent.GetAngularVelocity will return the previous velocity until the write occurs. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

SetBounce

public void SetBounce(float bounce)

Sets the bounce of this RigidBodyComponent.

ParameterTypeDescription
bouncefloatThe bounce factor. Value should be between 0 and 1 (inclusive)
Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

Deprecated
[System.Obsolete("Deprecated. Use the Action<> overload", false)] public ulong SetBounce(     float bounce,     Sansar.Script.ScriptBase.OperationComplete handler )

Sets the bounce of this RigidBodyComponent.

ParameterTypeDescription
bouncefloatThe bounce factor. Value should be between 0 and 1 (inclusive)
handlerSansar.Script.ScriptBase.OperationCompleteHandler to be called when the event completes.

Returns: ulong — The return value is an internal event id.

Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

public void SetBounce(     float bounce,     Action<Sansar.Script.OperationCompleteEvent> handler )

Sets the bounce of this RigidBodyComponent.

ParameterTypeDescription
bouncefloatThe bounce factor. Value should be between 0 and 1 (inclusive)
handlerAction<Sansar.Script.OperationCompleteEvent>Handler to be called when the event completes.
Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

SetCanGrab

public void SetCanGrab(bool canGrab)

Sets the can grab state for this rigidbody.

ParameterTypeDescription
canGrabboolBoolean value to indicate if the rigid body can be grabbed.
Remarks

This method will throw an exception if the rigid body has the static motion type. This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

public void SetCanGrab(     bool canGrab,     Action<Sansar.Script.OperationCompleteEvent> handler )

Sets the can grab state for this rigidbody.

ParameterTypeDescription
canGrabboolBoolean value to indicate if the rigid body can be grabbed.
handlerAction<Sansar.Script.OperationCompleteEvent>Handler to be called when the event completes.
Remarks

This method will throw an exception if the rigid body has the static motion type. This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

SetCenterOfMass

public void SetCenterOfMass(Sansar.Vector centerOfMass)

Sets the center of mass of this object in local space.

ParameterTypeDescription
centerOfMassSansar.VectorA Vector to the center of mass of this object, in the objects local space.
Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

Deprecated
[System.Obsolete("Deprecated. Use the Action<> overload", false)] public ulong SetCenterOfMass(     Sansar.Vector centerOfMass,     Sansar.Script.ScriptBase.OperationComplete handler )

Sets the center of mass of this object in local space.

ParameterTypeDescription
centerOfMassSansar.VectorA Vector to the center of mass of this object, in the objects local space.
handlerSansar.Script.ScriptBase.OperationCompleteHandler to be called when the event completes.

Returns: ulong — The return value is an internal event id.

Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

public void SetCenterOfMass(     Sansar.Vector centerOfMass,     Action<Sansar.Script.OperationCompleteEvent> handler )

Sets the center of mass of this object in local space.

ParameterTypeDescription
centerOfMassSansar.VectorA Vector to the center of mass of this object, in the objects local space.
handlerAction<Sansar.Script.OperationCompleteEvent>Handler to be called when the event completes.
Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

SetDynamicFriction

public void SetDynamicFriction(float dynamicFriction)

Sets the dynamic friction of this RigidBodyComponent.

ParameterTypeDescription
dynamicFrictionfloatThe dynamic friction. Value should be between 0 and 1 (inclusive)
Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

Deprecated
[System.Obsolete("Deprecated. Use the Action<> overload", false)] public ulong SetDynamicFriction(     float dynamicFriction,     Sansar.Script.ScriptBase.OperationComplete handler )

Sets the dynamic friction of this RigidBodyComponent.

ParameterTypeDescription
dynamicFrictionfloatThe dynamic friction. Value should be between 0 and 1 (inclusive)
handlerSansar.Script.ScriptBase.OperationCompleteHandler to be called when the event completes.

Returns: ulong — The return value is an internal event id.

Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

public void SetDynamicFriction(     float dynamicFriction,     Action<Sansar.Script.OperationCompleteEvent> handler )

Sets the dynamic friction of this RigidBodyComponent.

ParameterTypeDescription
dynamicFrictionfloatThe dynamic friction. Value should be between 0 and 1 (inclusive)
handlerAction<Sansar.Script.OperationCompleteEvent>Handler to be called when the event completes.
Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

SetGravityFactor

public void SetGravityFactor(float gravityFactor)

Sets what factor of the world’s gravity is applied to this object.

ParameterTypeDescription
gravityFactorfloatThe gravityFactor. Default value is 1, range is -2 to 2
Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

Deprecated
[System.Obsolete("Deprecated. Use the Action<> overload", false)] public ulong SetGravityFactor(     float gravityFactor,     Sansar.Script.ScriptBase.OperationComplete handler )

Sets what factor of the world’s gravity is applied to this object.

ParameterTypeDescription
gravityFactorfloatThe gravityFactor. Default value is 1, range is -2 to 2
handlerSansar.Script.ScriptBase.OperationCompleteHandler to be called when the event completes.

Returns: ulong — The return value is an internal event id.

Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

public void SetGravityFactor(     float gravityFactor,     Action<Sansar.Script.OperationCompleteEvent> handler )

Sets what factor of the world’s gravity is applied to this object.

ParameterTypeDescription
gravityFactorfloatThe gravityFactor. Default value is 1, range is -2 to 2
handlerAction<Sansar.Script.OperationCompleteEvent>Handler to be called when the event completes.
Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

SetInverseInertia

public void SetInverseInertia(Sansar.Vector inverseInertia)

Sets the moment of inertia for this object.

ParameterTypeDescription
inverseInertiaSansar.VectorA Vector representation of the inverse moment of inertia for this object in world space.
Remarks

Setting this to zero in the x and y components, for example, will give this object infinite inertia on the x and y axes and only permit it to rotate around the z axis. This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

public void SetInverseInertia(     Sansar.Vector inverseInertia,     Action<Sansar.Script.OperationCompleteEvent> handler )

Sets the moment of inertia for this object.

ParameterTypeDescription
inverseInertiaSansar.VectorA Vector representation of the inverse moment of inertia for this object in world space.
handlerAction<Sansar.Script.OperationCompleteEvent>Handler to be called when the event completes.
Remarks

Setting this to zero in the x and y components, for example, will give this object infinite inertia on the x and y axes and only permit it to rotate around the z axis. This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

SetLinearDamping

public void SetLinearDamping(float linearDamping)

Sets the amount of damping to apply to this object’s linear motion.

ParameterTypeDescription
linearDampingfloatThe linear damping factor. Default value is 0.
Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

Deprecated
[System.Obsolete("Deprecated. Use the Action<> overload", false)] public ulong SetLinearDamping(     float linearDamping,     Sansar.Script.ScriptBase.OperationComplete handler )

Sets the amount of damping to apply to this object’s linear motion.

ParameterTypeDescription
linearDampingfloatThe linear damping factor. Default value is 0.
handlerSansar.Script.ScriptBase.OperationCompleteHandler to be called when the event completes.

Returns: ulong — The return value is an internal event id.

Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

public void SetLinearDamping(     float linearDamping,     Action<Sansar.Script.OperationCompleteEvent> handler )

Sets the amount of damping to apply to this object’s linear motion.

ParameterTypeDescription
linearDampingfloatThe linear damping factor. Default value is 0.
handlerAction<Sansar.Script.OperationCompleteEvent>Handler to be called when the event completes.
Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

SetLinearVelocity

public void SetLinearVelocity(Sansar.Vector velocity)

Sets the linear velocity for this RigidBodyComponent. Linear velocity is clamped between -200m/s and 200m/s.

ParameterTypeDescription
velocitySansar.VectorThe velocity.
Remarks

This asynchronous method queues the write then returns. Subsequent calls to RigidBodyComponent.GetLinearVelocity will return the previous velocity until the write occurs. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

Deprecated
[System.Obsolete("Deprecated. Use the Action<> overload", false)] public ulong SetLinearVelocity(     Sansar.Vector velocity,     Sansar.Script.ScriptBase.OperationComplete handler )

Sets the linear velocity for this RigidBodyComponent.

ParameterTypeDescription
velocitySansar.VectorThe velocity.
handlerSansar.Script.ScriptBase.OperationCompleteHandler to be called when the event completes.

Returns: ulong — The return value is an internal event id.

Remarks

This asynchronous method queues the write then returns. Subsequent calls to RigidBodyComponent.GetLinearVelocity will return the previous velocity until the write occurs. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

public void SetLinearVelocity(     Sansar.Vector velocity,     Action<Sansar.Script.OperationCompleteEvent> handler )

Sets the linear velocity for this RigidBodyComponent. Linear velocity is clamped between -200m/s and 200m/s.

ParameterTypeDescription
velocitySansar.VectorThe velocity.
handlerAction<Sansar.Script.OperationCompleteEvent>Handler to be called when the event completes.
Remarks

This asynchronous method queues the write then returns. Subsequent calls to RigidBodyComponent.GetLinearVelocity will return the previous velocity until the write occurs. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

SetMass

public void SetMass(float mass)

Sets the mass of this RigidBodyComponent.

ParameterTypeDescription
massfloatThe mass.
Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

Deprecated
[System.Obsolete("Deprecated. Use the Action<> overload", false)] public ulong SetMass(     float mass,     Sansar.Script.ScriptBase.OperationComplete handler )

Sets the mass of this RigidBodyComponent.

ParameterTypeDescription
massfloatThe mass.
handlerSansar.Script.ScriptBase.OperationCompleteHandler to be called when the event completes.

Returns: ulong — The return value is an internal event id.

Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

public void SetMass(     float mass,     Action<Sansar.Script.OperationCompleteEvent> handler )

Sets the mass of this RigidBodyComponent.

ParameterTypeDescription
massfloatThe mass.
handlerAction<Sansar.Script.OperationCompleteEvent>Handler to be called when the event completes.
Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

SetMotionType

public void SetMotionType(RigidBodyMotionType motionType)

Sets the motion type for this rigidbody.

ParameterTypeDescription
motionTypeRigidBodyMotionTypeThe motion type.
Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

Deprecated
[System.Obsolete("Deprecated. Use the Action<> overload", false)] public ulong SetMotionType(     RigidBodyMotionType motionType,     Sansar.Script.ScriptBase.OperationComplete handler )

Sets the motion type for this rigidbody.

ParameterTypeDescription
motionTypeRigidBodyMotionTypeThe motion type.
handlerSansar.Script.ScriptBase.OperationCompleteHandler to be called when the event completes.

Returns: ulong — The return value is an internal event id.

Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

public void SetMotionType(     RigidBodyMotionType motionType,     Action<Sansar.Script.OperationCompleteEvent> handler )

Sets the motion type for this rigidbody.

ParameterTypeDescription
motionTypeRigidBodyMotionTypeThe motion type.
handlerAction<Sansar.Script.OperationCompleteEvent>Handler to be called when the event completes.
Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

SetOrientation

public void SetOrientation(Sansar.Quaternion orientation)

Sets the orientation of this RigidBodyComponent.

ParameterTypeDescription
orientationSansar.QuaternionThe orientation.
Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

Deprecated
[System.Obsolete("Use SetOrientation(Quaternion)", false)] public ulong SetOrientation(Sansar.Vector orientation)

Sets the orientation of this $className$.

ParameterTypeDescription
orientationSansar.VectorThe orientation.

Returns: ulong — The return value is an internal event id.

Remarks

Deprecated. Use SetOrientation(Quaternion) instead.

Deprecated
[System.Obsolete("Deprecated. Use the Action<> overload", false)] public ulong SetOrientation(     Sansar.Quaternion orientation,     Sansar.Script.ScriptBase.OperationComplete handler )

Sets the orientation of this RigidBodyComponent.

ParameterTypeDescription
orientationSansar.QuaternionThe orientation.
handlerSansar.Script.ScriptBase.OperationCompleteHandler to be called when the event completes.

Returns: ulong — The return value is an internal event id.

Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

public void SetOrientation(     Sansar.Quaternion orientation,     Action<Sansar.Script.OperationCompleteEvent> handler )

Sets the orientation of this RigidBodyComponent.

ParameterTypeDescription
orientationSansar.QuaternionThe orientation.
handlerAction<Sansar.Script.OperationCompleteEvent>Handler to be called when the event completes.
Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

Deprecated
[System.Obsolete("Use SetOrientation(Quaternion)", false)] public ulong SetOrientation(     Sansar.Vector orientation,     Sansar.Script.ScriptBase.OperationComplete handler )

Sets the orientation of this $className$.

ParameterTypeDescription
orientationSansar.VectorThe orientation.
handlerSansar.Script.ScriptBase.OperationCompleteHandler to be called when the event completes.

Returns: ulong — The return value is an internal event id.

Remarks

Deprecated. Use SetOrientation(Quaternion) instead.

Deprecated
[System.Obsolete("Use SetOrientation(Quaternion)", false)] public ulong SetOrientation(     Sansar.Vector orientation,     Action<Sansar.Script.OperationCompleteEvent> handler )

Sets the orientation of this $className$.

ParameterTypeDescription
orientationSansar.VectorThe orientation.
handlerAction<Sansar.Script.OperationCompleteEvent>Handler to be called when the event completes.

Returns: ulong — The return value is an internal event id.

Remarks

Deprecated. Use SetOrientation(Quaternion) instead.

SetPosition

public void SetPosition(Sansar.Vector position)

Sets the position of this RigidBodyComponent.

ParameterTypeDescription
positionSansar.VectorThe position.
Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

Deprecated
[System.Obsolete("Deprecated. Use the Action<> overload", false)] public ulong SetPosition(     Sansar.Vector position,     Sansar.Script.ScriptBase.OperationComplete handler )

Sets the position of this RigidBodyComponent.

ParameterTypeDescription
positionSansar.VectorThe position.
handlerSansar.Script.ScriptBase.OperationCompleteHandler to be called when the event completes.

Returns: ulong — The return value is an internal event id.

Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

public void SetPosition(     Sansar.Vector position,     Action<Sansar.Script.OperationCompleteEvent> handler )

Sets the position of this RigidBodyComponent.

ParameterTypeDescription
positionSansar.VectorThe position.
handlerAction<Sansar.Script.OperationCompleteEvent>Handler to be called when the event completes.
Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

SetStaticFriction

public void SetStaticFriction(float staticFriction)

Sets the static friction of this RigidBodyComponent.

ParameterTypeDescription
staticFrictionfloatThe static friction. Value should be between 0 and 1 (inclusive)
Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

Deprecated
[System.Obsolete("Deprecated. Use the Action<> overload", false)] public ulong SetStaticFriction(     float staticFriction,     Sansar.Script.ScriptBase.OperationComplete handler )

Sets the static friction of this RigidBodyComponent.

ParameterTypeDescription
staticFrictionfloatThe static friction. Value should be between 0 and 1 (inclusive)
handlerSansar.Script.ScriptBase.OperationCompleteHandler to be called when the event completes.

Returns: ulong — The return value is an internal event id.

Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

public void SetStaticFriction(     float staticFriction,     Action<Sansar.Script.OperationCompleteEvent> handler )

Sets the static friction of this RigidBodyComponent.

ParameterTypeDescription
staticFrictionfloatThe static friction. Value should be between 0 and 1 (inclusive)
handlerAction<Sansar.Script.OperationCompleteEvent>Handler to be called when the event completes.
Remarks

This asynchronous method queues the write then returns. To block until the write has occurred, pass this method to ScriptBase.WaitFor while in a coroutine.

Subscribe

Deprecated
[System.Obsolete("Use subscription callbacks of type Action<Sansar.Simulation.CollisionData>", false)] public void Subscribe(     CollisionEventType EventType,     RigidBodyComponent.SubscriptionHandler callback,     bool persistent )

Subscribes to Collision Events.

ParameterTypeDescription
EventTypeCollisionEventTypeThe type of collision which occurred.
callbackRigidBodyComponent.SubscriptionHandlerCallback which is executed when the event completes.
persistentboolOptional, set to false to unsubscribe after one event.
public Sansar.Script.IEventSubscription Subscribe(     CollisionEventType EventType,     Action<CollisionData> callback,     bool persistent )

Subscribes to Collision Events.

ParameterTypeDescription
EventTypeCollisionEventTypeThe type of collision which occurred.
callbackAction<CollisionData>Callback which is executed when the event completes.
persistentboolOptional, set to false to unsubscribe after one event.

Returns: Sansar.Script.IEventSubscription — An IEventSubscription that can be used to cancel the subscription.

Deprecated
[System.Obsolete("Use subscription callbacks of type Action<Sansar.Simulation.CollisionData>", false)] public void Subscribe(     CollisionEventType EventType,     Sansar.Script.ComponentId HitComponentId,     RigidBodyComponent.SubscriptionHandler callback,     bool persistent )

Subscribes to Collision Events.

ParameterTypeDescription
EventTypeCollisionEventTypeThe type of collision which occurred.
HitComponentIdSansar.Script.ComponentIdThe id of the rigid body component or character that was hit.
callbackRigidBodyComponent.SubscriptionHandlerCallback which is executed when the event completes.
persistentboolOptional, set to false to unsubscribe after one event.
public Sansar.Script.IEventSubscription Subscribe(     CollisionEventType EventType,     Sansar.Script.ComponentId HitComponentId,     Action<CollisionData> callback,     bool persistent )

Subscribes to Collision Events.

ParameterTypeDescription
EventTypeCollisionEventTypeThe type of collision which occurred.
HitComponentIdSansar.Script.ComponentIdThe id of the rigid body component or character that was hit.
callbackAction<CollisionData>Callback which is executed when the event completes.
persistentboolOptional, set to false to unsubscribe after one event.

Returns: Sansar.Script.IEventSubscription — An IEventSubscription that can be used to cancel the subscription.

SubscribeToHeldObject

public Sansar.Script.IEventSubscription SubscribeToHeldObject(     HeldObjectEventType HeldObjectEvent,     Action<HeldObjectData> callback,     bool persistent )

Subscribes to HeldObject Events.

ParameterTypeDescription
HeldObjectEventHeldObjectEventTypeThe type of held object event which occurred.
callbackAction<HeldObjectData>Callback which is executed when the event completes.
persistentboolOptional, set to false to unsubscribe after one event.

Returns: Sansar.Script.IEventSubscription — An IEventSubscription that can be used to cancel the subscription.

SubscribeToSitObject

public Sansar.Script.IEventSubscription SubscribeToSitObject(     SitEventType SitObjectEvent,     Action<SitObjectData> callback,     bool persistent )

Subscribes to SitObject Events.

ParameterTypeDescription
SitObjectEventSitEventTypeThe type of sit event which occurred.
callbackAction<SitObjectData>Callback which is executed when the event completes.
persistentboolOptional, set to false to unsubscribe after one event.

Returns: Sansar.Script.IEventSubscription — An IEventSubscription that can be used to cancel the subscription.

ToString

public override string ToString()

A string representation of this object.

Returns: string — A string representation of this object.

Remarks

The format of this string may change between releases.

Used in examples

…and 15 more examples in the snapshot.

Generated from the Sansar 47.10.0 client ScriptApi snapshot.