Humanoid Control for Unity  v3
Passer.MechanicalJoint Class Reference

Unity Inspector

Mechanical Joints can be used to limit the movements of a Kinematic Rigidbody in local space.

Inherits MonoBehaviour.

Inherited by Passer.KinematicLimitations.

Public Types

enum  RotationMethod { AngleDifference, PositionDifference }
 

Public Member Functions

void LerpX (float f)
 Linearly interpolates between min and maxLocalPostion.x More...
 
void LerpY (float f)
 Linearly interpolates between min and maxLocalPostion.y More...
 
void LerpZ (float f)
 Linearly interpolates between min and maxLocalPostion.z More...
 
Vector3 GetCorrectionVector ()
 
Quaternion GetCorrectionRotation ()
 
Quaternion GetCorrectionAxisRotation ()
 
Quaternion GetCorrectionAxisRotation_old ()
 
Quaternion GetCorrectionAxisRotation2 ()
 
void MoveForward (float speedZ)
 
void MoveSideward (float speedX)
 
void MoveUpward (float speedY)
 
void SetSpeed (Vector3 speed)
 
void Rotate (float speed)
 

Public Attributes

Transform parent
 
bool limitX = true
 When true, the local X-position is limited More...
 
bool limitY = true
 When true, the local Y-position is limited More...
 
bool limitZ = true
 When true, the local Z-position is limited More...
 
Vector3 basePosition
 The base position for the bounds More...
 
Vector3 minLocalPosition
 The minimum local position. More...
 
Vector3 maxLocalPosition
 The maximum local position. More...
 
Quaternion baseRotation = Quaternion.identity
 The base rotation for the bounds More...
 
bool limitAngle = true
 When the the local rotation is limited More...
 
float minLocalAngle
 The maximum angle around the limitAngleAxis More...
 
float maxLocalAngle
 The maximum angle around the limitAngleAxis More...
 
Vector3 limitAngleAxis = Vector3.up
 The axis around which the Rigidbody can rotate More...
 
RotationMethod rotationMethod
 
GameObjectEventHandlers gameObjectEvent
 
FloatEventHandlers xSliderEvents
 
FloatEventHandlers ySliderEvents
 
FloatEventHandlers zSliderEvents
 
FloatEventHandlers angleEvents
 

Protected Member Functions

Vector3 GetLocalPosition ()
 
Vector3 GetWorldPosition (Vector3 localPosition)
 
virtual void Awake ()
 
virtual void Start ()
 
virtual void FixedUpdate ()
 
virtual void OnDestroy ()
 
void UpdateEvents ()
 
virtual void OnDrawGizmosSelected ()
 
Vector3 ProjectPointOnPlane (Vector3 point, Vector3 planeOrigin, Vector3 planeNormal)
 

Protected Attributes

Rigidbody rb
 
Transform t
 
float xValue
 
float yValue
 
float zValue
 
float angleValue
 
Vector3 speed
 
float rotationSpeed
 

Static Protected Attributes

static string[] sliderEventTypeLabels
 

Member Function Documentation

◆ LerpX()

void Passer.MechanicalJoint.LerpX ( float  f)

Linearly interpolates between min and maxLocalPostion.x

0 matches the minLocalPosition on the X axis 1 matches the maxLocalPosition on the X axis

◆ LerpY()

void Passer.MechanicalJoint.LerpY ( float  f)

Linearly interpolates between min and maxLocalPostion.y

0 matches the minLocalPosition on the Y axis 1 matches the maxLocalPosition on the Y axis

◆ LerpZ()

void Passer.MechanicalJoint.LerpZ ( float  f)

Linearly interpolates between min and maxLocalPostion.z

0 matches the minLocalPosition on the Z axis 1 matches the maxLocalPosition on the Z axis

Member Data Documentation

◆ limitX

bool Passer.MechanicalJoint.limitX = true

When true, the local X-position is limited

The limits are set by the X member of the minLocalPosition and maxLocalPosition When the bounds are both zero, the local X position is locked.

◆ limitY

bool Passer.MechanicalJoint.limitY = true

When true, the local Y-position is limited

The limits are set by the Y member of the minLocalPosition and maxLocalPosition When the bounds are both zero, the local Y position is locked.

◆ limitZ

bool Passer.MechanicalJoint.limitZ = true

When true, the local Z-position is limited

The limits are set by the Z member of the minLocalPosition and maxLocalPosition When the bounds are both zero, the local Z position is locked.

◆ basePosition

Vector3 Passer.MechanicalJoint.basePosition

The base position for the bounds

The minLocalPosition and maxLocalPosition are relative to the basePosition.

◆ minLocalPosition

Vector3 Passer.MechanicalJoint.minLocalPosition

The minimum local position.

This localPosition is relative to the basePosition.

◆ maxLocalPosition

Vector3 Passer.MechanicalJoint.maxLocalPosition

The maximum local position.

This localPosition is relative to the basePosition.

◆ baseRotation

Quaternion Passer.MechanicalJoint.baseRotation = Quaternion.identity

The base rotation for the bounds

◆ limitAngle

bool Passer.MechanicalJoint.limitAngle = true

When the the local rotation is limited

The limitation is determined by a maxLocalAngle around the limitAnglesAxis. With this limitation, the rigidbody can only rotated around the limmitAngleAxis.

◆ minLocalAngle

float Passer.MechanicalJoint.minLocalAngle

The maximum angle around the limitAngleAxis

When this is zero, the local rotation is locked.

◆ maxLocalAngle

float Passer.MechanicalJoint.maxLocalAngle

The maximum angle around the limitAngleAxis

When this is zero, the local rotation is locked.

◆ limitAngleAxis

Vector3 Passer.MechanicalJoint.limitAngleAxis = Vector3.up

The axis around which the Rigidbody can rotate

◆ gameObjectEvent

GameObjectEventHandlers Passer.MechanicalJoint.gameObjectEvent
Initial value:
= new GameObjectEventHandlers() {
label = "GameObject Event",
id = 0,
tooltip = "Call functions based on the GameObject life cycle",
eventTypeLabels = new string[] {
"Never",
"Start",
"On Destroy",
"Update",
" ",
" ",
" "
}
}

◆ sliderEventTypeLabels

string [] Passer.MechanicalJoint.sliderEventTypeLabels
staticprotected
Initial value:
= new string[] {
"Never",
"On Min",
"On Max",
"While Min",
"While Max",
"On Change",
"Continuous"
}

◆ xSliderEvents

FloatEventHandlers Passer.MechanicalJoint.xSliderEvents
Initial value:
= new FloatEventHandlers() {
label = "X Axis",
id = 1,
eventTypeLabels = sliderEventTypeLabels,
tooltip =
"Call function using the X axis range value\n" +
"Parameter: the range along the X axis (-1..1)"
}

◆ ySliderEvents

FloatEventHandlers Passer.MechanicalJoint.ySliderEvents
Initial value:
= new FloatEventHandlers() {
label = "Y Axis",
id = 2,
eventTypeLabels = sliderEventTypeLabels,
tooltip =
"Call function using the Y axis range value\n" +
"Parameter: the range along the Y axis (-1..1)"
}

◆ zSliderEvents

FloatEventHandlers Passer.MechanicalJoint.zSliderEvents
Initial value:
= new FloatEventHandlers() {
label = "Z Axis",
id = 3,
eventTypeLabels = sliderEventTypeLabels,
tooltip =
"Call function using the Z axis range value\n" +
"Parameter: the range along the Z axis (-1..1)"
}

◆ angleEvents

FloatEventHandlers Passer.MechanicalJoint.angleEvents
Initial value:
= new FloatEventHandlers() {
label = "Angle",
id = 4,
eventTypeLabels = sliderEventTypeLabels,
}

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