Impact Interaction System API
Impact.ImpactRigidbodyWrapper Class Reference

A wrapper class that consolidates Rigidbody and Rigidbody2D data. More...

Public Member Functions

 ImpactRigidbodyWrapper (GameObject gameObject)
 Initializes the wrapper for the given game object. More...
 
 ImpactRigidbodyWrapper (Rigidbody rigidbody3D)
 Initializes the wrapper for a 3D rigidbody. More...
 
 ImpactRigidbodyWrapper (Rigidbody2D rigidbody2D)
 Initializes the wrapper for a 2D rigidbody. More...
 
void FixedUpdate ()
 Update internally cached Center of Mass, Velocity, and Angular Velocity We need to cache these in FixedUpdate because of timing weirdness when trying to access them from OnCollision messages.
 
VelocityData GetVelocityData (Vector3 point)
 Gets the velocity of the given point using the cached rigidbody values.
 
VelocityData GetCurrentVelocityData (Vector3 point)
 Gets the velocity of the given point using values retrieved directly from the rigidbody.
 

Properties

PhysicsType PhysicsType [get]
 Whether this rigidbody wrapper contains a 3D or 2D rigidbody.
 
Rigidbody Rigidbody3D [get]
 The 3D rigidbody the wrapper contains, if applicable.
 
Rigidbody2D Rigidbody2D [get]
 The 2D rigidbody the wrapper contains, if applicable.
 
Vector3 Velocity [get]
 The linear velocity of the rigidbody. This must be manually set, usually in FixedUpdate.
 
Vector3 AngularVelocity [get]
 The angular velocity of the rigidbody. This must be manually set, usually in FixedUpdate.
 
Vector3 WorldCenterOfMass [get]
 The center of mass of the rigidbody in world space. This must be manually set, usually in FixedUpdate.
 
Vector3 CurrentVelocity [get]
 The actual current velocity of the Rigidbody or Rigidbody2D. This is retrieved directly from the rigidbody.
 
Vector3 CurrentAngularVelocity [get]
 The actual current angular velocity of the Rigidbody or Rigidbody2D. This is retrieved directly from the rigidbody.
 
Vector3 CurrentWorldCenterOfMass [get]
 The actual current center of mass of the Rigidbody or Rigidbody2D. This is retrieved directly from the rigidbody.
 

Detailed Description

A wrapper class that consolidates Rigidbody and Rigidbody2D data.

Constructor & Destructor Documentation

◆ ImpactRigidbodyWrapper() [1/3]

Impact.ImpactRigidbodyWrapper.ImpactRigidbodyWrapper ( GameObject  gameObject)

Initializes the wrapper for the given game object.

Parameters
gameObjectThe GameObject to use.

◆ ImpactRigidbodyWrapper() [2/3]

Impact.ImpactRigidbodyWrapper.ImpactRigidbodyWrapper ( Rigidbody  rigidbody3D)

Initializes the wrapper for a 3D rigidbody.

Parameters
rigidbody3DThe rigidbody to use.

◆ ImpactRigidbodyWrapper() [3/3]

Impact.ImpactRigidbodyWrapper.ImpactRigidbodyWrapper ( Rigidbody2D  rigidbody2D)

Initializes the wrapper for a 2D rigidbody.

Parameters
rigidbody2DThe rigidbody to use.