Character Controller Pro  1.3.8
A 2D/3D character controller asset for the Unity Engine.
Lightbug.Utilities.RigidbodyComponent Class Referenceabstract

This component is a wrapper for the Rigidbody and Rigidbody2D components, containing not only the most commonly used properties and methods, but also some extra features. More...

Inheritance diagram for Lightbug.Utilities.RigidbodyComponent:
Lightbug.Utilities.RigidbodyComponent2D Lightbug.Utilities.RigidbodyComponent3D

Public Member Functions

void SetPositionAndRotation (Vector3 position, Quaternion rotation)
 Sets the rigidbody position and rotation. More...
 
abstract void Interpolate (Vector3 position)
 Interpolates the rigidbody position (equivalent to MovePosition). More...
 
abstract void Interpolate (Quaternion rotation)
 Interpolates the rigidbody rotation (equivalent to MoveRotation). More...
 
void Interpolate (Vector3 position, Quaternion rotation)
 Interpolates the rigidbody position and rotation (equivalent to MovePosition and MoveRotation). More...
 
void Move (Vector3 position)
 Automatically moves the rigidbody based on its type. If the rigidbody is kinematic MovePosition will be used. If the rigidbody is dynamic the velocity will be set. More...
 
void Rotate (Quaternion rotation)
 Automatically rotates the rigidbody based on its type. If the rigidbody is kinematic MoveRotation will be used. If the rigidbody is dynamic the angular velocity will be set. More...
 
void MoveAndRotate (Vector3 position, Quaternion rotation)
 Uses both Move and Rotate method. More...
 
abstract Vector3 GetPointVelocity (Vector3 point)
 Gets the rigidbody velocity at a specific point in space. More...
 
abstract void AddForceToRigidbody (Vector3 force, ForceMode forceMode=ForceMode.Force)
 
abstract void AddExplosionForceToRigidbody (float explosionForce, Vector3 explosionPosition, float explosionRadius, float upwardsModifier=0f)
 
void AddForce (Vector3 force, bool ignoreMass=false, bool useImpulse=false)
 Adds a velocity vector to the rigidbody (simulating AddForce) calculated from a force value. More...
 
void AddExplosionForce (float explosionForce, Vector3 explosionPosition, float explosionRadius, float upwardsModifier=0f)
 Adds a velocity vector to the rigidbody (simulating AddExplosionForce) calculated from a force value. More...
 
void AddTorque (Vector3 torque, bool ignoreMass=false)
 Adds an angular velocity vector to the rigidbody (simulating AddTorque) calculated from a torque value. More...
 

Static Public Member Functions

static RigidbodyComponent CreateInstance (GameObject gameObject)
 

Protected Member Functions

void OnBodyTypeChangeInternal ()
 
virtual void Awake ()
 

Protected Attributes

bool previousContinuousCollisionDetection = false
 

Properties

abstract bool Is2D [get]
 
abstract float Mass [get, set]
 
abstract float LinearDrag [get, set]
 
abstract float AngularDrag [get, set]
 
abstract bool IsKinematic [get, set]
 
abstract bool UseGravity [get, set]
 
abstract bool UseInterpolation [get, set]
 
abstract bool ContinuousCollisionDetection [get, set]
 
abstract RigidbodyConstraints Constraints [get, set]
 
abstract bool IsUsingContinuousCollisionDetection [get]
 
Vector3 Up [get]
 Gets the current up direction based on the rigidbody rotation (not necessarily transform.up). More...
 
Vector3 Forward [get]
 Gets the current forward direction based on the rigidbody rotation (not necessarily transform.forward). More...
 
Vector3 Right [get]
 Gets the current up direction based on the rigidbody rotation (not necessarily transform.right) More...
 
abstract Vector3 Position [get, set]
 Gets the rigidbody position. More...
 
abstract Quaternion Rotation [get, set]
 Gets the rigidbody rotation. More...
 
abstract Vector3 Velocity [get, set]
 Gets the rigidbody linear velocity. More...
 
abstract Vector3 AngularVelocity [get, set]
 Gets the rigidbody angular velocity. More...
 

Events

System.Action OnBodyTypeChange
 

Detailed Description

This component is a wrapper for the Rigidbody and Rigidbody2D components, containing not only the most commonly used properties and methods, but also some extra features.

Member Function Documentation

◆ AddExplosionForce()

void Lightbug.Utilities.RigidbodyComponent.AddExplosionForce ( float  explosionForce,
Vector3  explosionPosition,
float  explosionRadius,
float  upwardsModifier = 0f 
)
inline

Adds a velocity vector to the rigidbody (simulating AddExplosionForce) calculated from a force value.

◆ AddForce()

void Lightbug.Utilities.RigidbodyComponent.AddForce ( Vector3  force,
bool  ignoreMass = false,
bool  useImpulse = false 
)
inline

Adds a velocity vector to the rigidbody (simulating AddForce) calculated from a force value.

◆ AddTorque()

void Lightbug.Utilities.RigidbodyComponent.AddTorque ( Vector3  torque,
bool  ignoreMass = false 
)
inline

Adds an angular velocity vector to the rigidbody (simulating AddTorque) calculated from a torque value.

◆ GetPointVelocity()

abstract Vector3 Lightbug.Utilities.RigidbodyComponent.GetPointVelocity ( Vector3  point)
pure virtual

Gets the rigidbody velocity at a specific point in space.

Implemented in Lightbug.Utilities.RigidbodyComponent2D, and Lightbug.Utilities.RigidbodyComponent3D.

◆ Interpolate() [1/3]

abstract void Lightbug.Utilities.RigidbodyComponent.Interpolate ( Vector3  position)
pure virtual

Interpolates the rigidbody position (equivalent to MovePosition).

Implemented in Lightbug.Utilities.RigidbodyComponent2D, and Lightbug.Utilities.RigidbodyComponent3D.

◆ Interpolate() [2/3]

abstract void Lightbug.Utilities.RigidbodyComponent.Interpolate ( Quaternion  rotation)
pure virtual

Interpolates the rigidbody rotation (equivalent to MoveRotation).

Implemented in Lightbug.Utilities.RigidbodyComponent2D, and Lightbug.Utilities.RigidbodyComponent3D.

◆ Interpolate() [3/3]

void Lightbug.Utilities.RigidbodyComponent.Interpolate ( Vector3  position,
Quaternion  rotation 
)
inline

Interpolates the rigidbody position and rotation (equivalent to MovePosition and MoveRotation).

Parameters
positionthe target position
rotationthe target rotation

◆ Move()

void Lightbug.Utilities.RigidbodyComponent.Move ( Vector3  position)
inline

Automatically moves the rigidbody based on its type. If the rigidbody is kinematic MovePosition will be used. If the rigidbody is dynamic the velocity will be set.

Parameters
positionthe target position

◆ MoveAndRotate()

void Lightbug.Utilities.RigidbodyComponent.MoveAndRotate ( Vector3  position,
Quaternion  rotation 
)
inline

Uses both Move and Rotate method.

◆ Rotate()

void Lightbug.Utilities.RigidbodyComponent.Rotate ( Quaternion  rotation)
inline

Automatically rotates the rigidbody based on its type. If the rigidbody is kinematic MoveRotation will be used. If the rigidbody is dynamic the angular velocity will be set.

Parameters
rotationthe target rotation

◆ SetPositionAndRotation()

void Lightbug.Utilities.RigidbodyComponent.SetPositionAndRotation ( Vector3  position,
Quaternion  rotation 
)
inline

Sets the rigidbody position and rotation.

Property Documentation

◆ AngularVelocity

abstract Vector3 Lightbug.Utilities.RigidbodyComponent.AngularVelocity
getset

Gets the rigidbody angular velocity.

◆ Forward

Vector3 Lightbug.Utilities.RigidbodyComponent.Forward
get

Gets the current forward direction based on the rigidbody rotation (not necessarily transform.forward).

◆ Position

abstract Vector3 Lightbug.Utilities.RigidbodyComponent.Position
getset

Gets the rigidbody position.

◆ Right

Vector3 Lightbug.Utilities.RigidbodyComponent.Right
get

Gets the current up direction based on the rigidbody rotation (not necessarily transform.right)

◆ Rotation

abstract Quaternion Lightbug.Utilities.RigidbodyComponent.Rotation
getset

Gets the rigidbody rotation.

◆ Up

Vector3 Lightbug.Utilities.RigidbodyComponent.Up
get

Gets the current up direction based on the rigidbody rotation (not necessarily transform.up).

◆ Velocity

abstract Vector3 Lightbug.Utilities.RigidbodyComponent.Velocity
getset

Gets the rigidbody linear velocity.


The documentation for this class was generated from the following file: