The RigidBodyComponent handles interactions with rigid body physics.
public class RigidBodyComponent : Sansar.Script.InstanceInterfaceMembers at a glance
Fields
ComponentType
public static readonly ComponentType ComponentTypeThe 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
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.
| Parameter | Type | Description |
|---|---|---|
impulse | Sansar.Vector | The 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.
[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.
| Parameter | Type | Description |
|---|---|---|
impulse | Sansar.Vector | The impulse. |
handler | Sansar.Script.ScriptBase.OperationComplete | Handler 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.
| Parameter | Type | Description |
|---|---|---|
impulse | Sansar.Vector | The impulse. |
handler | Action<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.
| Parameter | Type | Description |
|---|---|---|
impulse | Sansar.Vector | The 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.
[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.
| Parameter | Type | Description |
|---|---|---|
impulse | Sansar.Vector | The impulse. |
handler | Sansar.Script.ScriptBase.OperationComplete | Handler 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.
| Parameter | Type | Description |
|---|---|---|
impulse | Sansar.Vector | The impulse. |
handler | Action<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
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
[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.
public void ReleaseHeldObject(
Action<Sansar.Script.OperationCompleteEvent> handler
)Force any agent holding this object to drop it.
| Parameter | Type | Description |
|---|---|---|
handler | Action<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.
| Parameter | Type | Description |
|---|---|---|
angularDamping | float | The 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.
[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.
| Parameter | Type | Description |
|---|---|---|
angularDamping | float | The angular damping factor. Default value is 0. |
handler | Sansar.Script.ScriptBase.OperationComplete | Handler 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.
| Parameter | Type | Description |
|---|---|---|
angularDamping | float | The angular damping factor. Default value is 0. |
handler | Action<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.
| Parameter | Type | Description |
|---|---|---|
velocity | Sansar.Vector | The 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.
[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.
| Parameter | Type | Description |
|---|---|---|
velocity | Sansar.Vector | The velocity. |
handler | Sansar.Script.ScriptBase.OperationComplete | Handler 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.
| Parameter | Type | Description |
|---|---|---|
velocity | Sansar.Vector | The velocity. |
handler | Action<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.
| Parameter | Type | Description |
|---|---|---|
bounce | float | The 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.
[System.Obsolete("Deprecated. Use the Action<> overload", false)]
public ulong SetBounce(
float bounce,
Sansar.Script.ScriptBase.OperationComplete handler
)Sets the bounce of this RigidBodyComponent.
| Parameter | Type | Description |
|---|---|---|
bounce | float | The bounce factor. Value should be between 0 and 1 (inclusive) |
handler | Sansar.Script.ScriptBase.OperationComplete | Handler 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.
| Parameter | Type | Description |
|---|---|---|
bounce | float | The bounce factor. Value should be between 0 and 1 (inclusive) |
handler | Action<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.
| Parameter | Type | Description |
|---|---|---|
canGrab | bool | Boolean 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.
| Parameter | Type | Description |
|---|---|---|
canGrab | bool | Boolean value to indicate if the rigid body can be grabbed. |
handler | Action<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.
| Parameter | Type | Description |
|---|---|---|
centerOfMass | Sansar.Vector | A 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.
[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.
| Parameter | Type | Description |
|---|---|---|
centerOfMass | Sansar.Vector | A Vector to the center of mass of this object, in the objects local space. |
handler | Sansar.Script.ScriptBase.OperationComplete | Handler 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.
| Parameter | Type | Description |
|---|---|---|
centerOfMass | Sansar.Vector | A Vector to the center of mass of this object, in the objects local space. |
handler | Action<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.
| Parameter | Type | Description |
|---|---|---|
dynamicFriction | float | The 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.
[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.
| Parameter | Type | Description |
|---|---|---|
dynamicFriction | float | The dynamic friction. Value should be between 0 and 1 (inclusive) |
handler | Sansar.Script.ScriptBase.OperationComplete | Handler 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.
| Parameter | Type | Description |
|---|---|---|
dynamicFriction | float | The dynamic friction. Value should be between 0 and 1 (inclusive) |
handler | Action<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.
| Parameter | Type | Description |
|---|---|---|
gravityFactor | float | The 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.
[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.
| Parameter | Type | Description |
|---|---|---|
gravityFactor | float | The gravityFactor. Default value is 1, range is -2 to 2 |
handler | Sansar.Script.ScriptBase.OperationComplete | Handler 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.
| Parameter | Type | Description |
|---|---|---|
gravityFactor | float | The gravityFactor. Default value is 1, range is -2 to 2 |
handler | Action<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.
| Parameter | Type | Description |
|---|---|---|
inverseInertia | Sansar.Vector | A 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.
| Parameter | Type | Description |
|---|---|---|
inverseInertia | Sansar.Vector | A Vector representation of the inverse moment of inertia for this object in world space. |
handler | Action<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.
| Parameter | Type | Description |
|---|---|---|
linearDamping | float | The 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.
[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.
| Parameter | Type | Description |
|---|---|---|
linearDamping | float | The linear damping factor. Default value is 0. |
handler | Sansar.Script.ScriptBase.OperationComplete | Handler 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.
| Parameter | Type | Description |
|---|---|---|
linearDamping | float | The linear damping factor. Default value is 0. |
handler | Action<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.
| Parameter | Type | Description |
|---|---|---|
velocity | Sansar.Vector | The 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.
[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.
| Parameter | Type | Description |
|---|---|---|
velocity | Sansar.Vector | The velocity. |
handler | Sansar.Script.ScriptBase.OperationComplete | Handler 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.
| Parameter | Type | Description |
|---|---|---|
velocity | Sansar.Vector | The velocity. |
handler | Action<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.
| Parameter | Type | Description |
|---|---|---|
mass | float | The 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.
[System.Obsolete("Deprecated. Use the Action<> overload", false)]
public ulong SetMass(
float mass,
Sansar.Script.ScriptBase.OperationComplete handler
)Sets the mass of this RigidBodyComponent.
| Parameter | Type | Description |
|---|---|---|
mass | float | The mass. |
handler | Sansar.Script.ScriptBase.OperationComplete | Handler 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.
| Parameter | Type | Description |
|---|---|---|
mass | float | The mass. |
handler | Action<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.
| Parameter | Type | Description |
|---|---|---|
motionType | RigidBodyMotionType | The 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.
[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.
| Parameter | Type | Description |
|---|---|---|
motionType | RigidBodyMotionType | The motion type. |
handler | Sansar.Script.ScriptBase.OperationComplete | Handler 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.
| Parameter | Type | Description |
|---|---|---|
motionType | RigidBodyMotionType | The motion type. |
handler | Action<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.
| Parameter | Type | Description |
|---|---|---|
orientation | Sansar.Quaternion | The 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.
[System.Obsolete("Use SetOrientation(Quaternion)", false)]
public ulong SetOrientation(Sansar.Vector orientation)Sets the orientation of this $className$.
| Parameter | Type | Description |
|---|---|---|
orientation | Sansar.Vector | The orientation. |
Returns: ulong — The return value is an internal event id.
Remarks
Deprecated. Use SetOrientation(Quaternion) instead.
[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.
| Parameter | Type | Description |
|---|---|---|
orientation | Sansar.Quaternion | The orientation. |
handler | Sansar.Script.ScriptBase.OperationComplete | Handler 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.
| Parameter | Type | Description |
|---|---|---|
orientation | Sansar.Quaternion | The orientation. |
handler | Action<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.
[System.Obsolete("Use SetOrientation(Quaternion)", false)]
public ulong SetOrientation(
Sansar.Vector orientation,
Sansar.Script.ScriptBase.OperationComplete handler
)Sets the orientation of this $className$.
| Parameter | Type | Description |
|---|---|---|
orientation | Sansar.Vector | The orientation. |
handler | Sansar.Script.ScriptBase.OperationComplete | Handler to be called when the event completes. |
Returns: ulong — The return value is an internal event id.
Remarks
Deprecated. Use SetOrientation(Quaternion) instead.
[System.Obsolete("Use SetOrientation(Quaternion)", false)]
public ulong SetOrientation(
Sansar.Vector orientation,
Action<Sansar.Script.OperationCompleteEvent> handler
)Sets the orientation of this $className$.
| Parameter | Type | Description |
|---|---|---|
orientation | Sansar.Vector | The orientation. |
handler | Action<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.
| Parameter | Type | Description |
|---|---|---|
position | Sansar.Vector | The 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.
[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.
| Parameter | Type | Description |
|---|---|---|
position | Sansar.Vector | The position. |
handler | Sansar.Script.ScriptBase.OperationComplete | Handler 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.
| Parameter | Type | Description |
|---|---|---|
position | Sansar.Vector | The position. |
handler | Action<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.
| Parameter | Type | Description |
|---|---|---|
staticFriction | float | The 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.
[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.
| Parameter | Type | Description |
|---|---|---|
staticFriction | float | The static friction. Value should be between 0 and 1 (inclusive) |
handler | Sansar.Script.ScriptBase.OperationComplete | Handler 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.
| Parameter | Type | Description |
|---|---|---|
staticFriction | float | The static friction. Value should be between 0 and 1 (inclusive) |
handler | Action<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
[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.
| Parameter | Type | Description |
|---|---|---|
EventType | CollisionEventType | The type of collision which occurred. |
callback | RigidBodyComponent.SubscriptionHandler | Callback which is executed when the event completes. |
persistent | bool | Optional, set to false to unsubscribe after one event. |
public Sansar.Script.IEventSubscription Subscribe(
CollisionEventType EventType,
Action<CollisionData> callback,
bool persistent
)Subscribes to Collision Events.
| Parameter | Type | Description |
|---|---|---|
EventType | CollisionEventType | The type of collision which occurred. |
callback | Action<CollisionData> | Callback which is executed when the event completes. |
persistent | bool | Optional, set to false to unsubscribe after one event. |
Returns: Sansar.Script.IEventSubscription — An IEventSubscription that can be used to cancel the subscription.
[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.
| Parameter | Type | Description |
|---|---|---|
EventType | CollisionEventType | The type of collision which occurred. |
HitComponentId | Sansar.Script.ComponentId | The id of the rigid body component or character that was hit. |
callback | RigidBodyComponent.SubscriptionHandler | Callback which is executed when the event completes. |
persistent | bool | Optional, 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.
| Parameter | Type | Description |
|---|---|---|
EventType | CollisionEventType | The type of collision which occurred. |
HitComponentId | Sansar.Script.ComponentId | The id of the rigid body component or character that was hit. |
callback | Action<CollisionData> | Callback which is executed when the event completes. |
persistent | bool | Optional, 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.
| Parameter | Type | Description |
|---|---|---|
HeldObjectEvent | HeldObjectEventType | The type of held object event which occurred. |
callback | Action<HeldObjectData> | Callback which is executed when the event completes. |
persistent | bool | Optional, 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.
| Parameter | Type | Description |
|---|---|---|
SitObjectEvent | SitEventType | The type of sit event which occurred. |
callback | Action<SitObjectData> | Callback which is executed when the event completes. |
persistent | bool | Optional, 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
- FollowThePath.cs
- MoverExample1.cs
- RandomMovement.cs
- ReflectiveDetectorExample.cs
- AgentGravityExample.cs
- AgentScaleExample.cs
- BanHammerExample.cs
- EventExample.cs
- ObjectScriptExample.cs
- PewPewExample.cs
- SceneObjectScriptExample.cs
- ScriptLibrary/Quest/QuestGiverTrigger.cs
…and 15 more examples in the snapshot.
Generated from the Sansar 47.10.0 client ScriptApi snapshot.