9 [RequireComponent(typeof(TSCollider))]
10 [AddComponentMenu(
"TrueSync/Physics/TSRigidBody", 11)]
13 public enum InterpolateMode { None, Interpolate, Extrapolate };
15 [FormerlySerializedAs(
"mass")]
41 private bool _useGravity =
true;
65 private bool _isKinematic;
106 if (_tsCollider == null) {
107 _tsCollider = GetComponent<TSCollider>();
121 if (_tsTransform == null) {
122 _tsTransform = GetComponent<TSTransform>();
145 if (mode == ForceMode.Force) {
147 }
else if (mode == ForceMode.Impulse) {
159 AddForce(force, position, ForceMode.Impulse);
169 if (mode == ForceMode.Force) {
171 }
else if (mode == ForceMode.Impulse) {
bool useGravity
If true it uses gravity force.
void MoveRotation(TSQuaternion rot)
Rotates the body to a provided rotation.
void AddForce(TSVector force, TSVector position)
Applies the provided force in the body.
void TSApplyForce(TSVector force)
Applies a force to the body's center.
void MovePosition(TSVector position)
Moves the body to a new position.
Represents a physical 3D rigid body.
void TSApplyImpulse(TSVector force)
Applies a impulse to the body's center.
static TSMatrix CreateFromLookAt(TSVector position, TSVector target)
Creates a JMatrix representing an orientation from a quaternion.
InterpolateMode interpolation
Interpolation mode that should be used.
void AddForce(TSVector force, TSVector position, ForceMode mode)
Applies the provided force in the body.
bool isKinematic
If true it doesn't get influences from external forces.
void TSApplyTorque(TSVector force)
Applies a torque force to the body.
Abstract collider for 3D shapes.
TSTransform tsTransform
Returns the TSTransform attached.
static TSQuaternion CreateFromMatrix(TSMatrix matrix)
Creates a quaternion from a matrix.
void LookAt(TSVector target)
Changes orientation to look at target position.
void AddForce(TSVector force, ForceMode mode)
Applies the provided force in the body.
bool freezeZAxis
If true it freezes Z rotation of the RigidBody (it only appears when in 2D Physics).
void AddForce(TSVector force)
Applies the provided force in the body.
TSCollider tsCollider
Returns the TSCollider attached.
bool TSIsKinematic
If true the body is managed as kinematic.
bool IsBodyInitialized
Returns true if the body was already initialized.
bool TSAffectedByGravity
If true the body is affected by gravity.
IBody3D Body
Returns the body linked to this collider.
A Quaternion representing an orientation.
TSVector TSLinearVelocity
Set/get body's linear velocity.
TSVector TSAngularVelocity
Set/get body's angular velocity.
TSVector position
Position of the body.
TSVector angularVelocity
AngularVelocity of the body.
TSVector velocity
LinearVelocity of the body.
TSQuaternion rotation
Orientation of the body.
void AddTorque(TSVector torque)
Simulates the provided tourque in the body.