Feel  5.1
The best way to improve your game's feel and make it extra juicy
MoreMountains.Tools.MMPreventPassingThrough3D Class Reference

Prevents fast moving objects from going through colliders by casting a ray backwards after each movement More...

Inheritance diagram for MoreMountains.Tools.MMPreventPassingThrough3D:

Public Types

enum  AdjustmentAxis { AdjustmentAxis.Auto, AdjustmentAxis.X, AdjustmentAxis.Y, AdjustmentAxis.Z }
 

Public Attributes

LayerMask ObstaclesLayerMask
 the layer mask to search obstacles on More...
 
float SkinWidth = 0.1f
 the bounds adjustment variable More...
 
bool RepositionRigidbody = true
 
LayerMask RepositionRigidbodyLayerMask
 the layer mask to filter when to reposition rigidbody More...
 
AdjustmentAxis Adjustment = AdjustmentAxis.Auto
 the local axis of the collider to use for adjustment (usually you'll want to use the axis the object is moving on) More...
 

Protected Member Functions

virtual void OnValidate ()
 
virtual void Start ()
 On Start we initialize our object More...
 
virtual void Initialization ()
 Grabs the rigidbody and computes the bounds width More...
 
virtual float ComputeAdjustmentDistance ()
 Determines the adjustment distance, over which we decide whether or not we've moved too far More...
 
virtual void OnEnable ()
 On Enable, we initialize our last frame position More...
 
virtual void FixedUpdate ()
 On fixedUpdate, checks the last movement and if needed casts a ray to detect obstacles More...
 

Protected Attributes

float _adjustmentDistance
 
float _adjustedDistance
 
float _squaredBoundsWidth
 
Vector3 _positionLastFrame
 
Rigidbody _rigidbody
 
Collider _collider
 
Vector3 _lastMovement
 
float _lastMovementSquared
 

Detailed Description

Prevents fast moving objects from going through colliders by casting a ray backwards after each movement

Member Enumeration Documentation

◆ AdjustmentAxis

Enumerator
Auto 

Member Function Documentation

◆ ComputeAdjustmentDistance()

virtual float MoreMountains.Tools.MMPreventPassingThrough3D.ComputeAdjustmentDistance ( )
protectedvirtual

Determines the adjustment distance, over which we decide whether or not we've moved too far

Returns

◆ FixedUpdate()

virtual void MoreMountains.Tools.MMPreventPassingThrough3D.FixedUpdate ( )
protectedvirtual

On fixedUpdate, checks the last movement and if needed casts a ray to detect obstacles

◆ Initialization()

virtual void MoreMountains.Tools.MMPreventPassingThrough3D.Initialization ( )
protectedvirtual

Grabs the rigidbody and computes the bounds width

◆ OnEnable()

virtual void MoreMountains.Tools.MMPreventPassingThrough3D.OnEnable ( )
protectedvirtual

On Enable, we initialize our last frame position

◆ OnValidate()

virtual void MoreMountains.Tools.MMPreventPassingThrough3D.OnValidate ( )
protectedvirtual

◆ Start()

virtual void MoreMountains.Tools.MMPreventPassingThrough3D.Start ( )
protectedvirtual

On Start we initialize our object

Member Data Documentation

◆ _adjustedDistance

float MoreMountains.Tools.MMPreventPassingThrough3D._adjustedDistance
protected

◆ _adjustmentDistance

float MoreMountains.Tools.MMPreventPassingThrough3D._adjustmentDistance
protected

◆ _collider

Collider MoreMountains.Tools.MMPreventPassingThrough3D._collider
protected

◆ _lastMovement

Vector3 MoreMountains.Tools.MMPreventPassingThrough3D._lastMovement
protected

◆ _lastMovementSquared

float MoreMountains.Tools.MMPreventPassingThrough3D._lastMovementSquared
protected

◆ _positionLastFrame

Vector3 MoreMountains.Tools.MMPreventPassingThrough3D._positionLastFrame
protected

◆ _rigidbody

Rigidbody MoreMountains.Tools.MMPreventPassingThrough3D._rigidbody
protected

◆ _squaredBoundsWidth

float MoreMountains.Tools.MMPreventPassingThrough3D._squaredBoundsWidth
protected

◆ Adjustment

AdjustmentAxis MoreMountains.Tools.MMPreventPassingThrough3D.Adjustment = AdjustmentAxis.Auto

the local axis of the collider to use for adjustment (usually you'll want to use the axis the object is moving on)

◆ ObstaclesLayerMask

LayerMask MoreMountains.Tools.MMPreventPassingThrough3D.ObstaclesLayerMask

the layer mask to search obstacles on

◆ RepositionRigidbody

bool MoreMountains.Tools.MMPreventPassingThrough3D.RepositionRigidbody = true

◆ RepositionRigidbodyLayerMask

LayerMask MoreMountains.Tools.MMPreventPassingThrough3D.RepositionRigidbodyLayerMask

the layer mask to filter when to reposition rigidbody

◆ SkinWidth

float MoreMountains.Tools.MMPreventPassingThrough3D.SkinWidth = 0.1f

the bounds adjustment variable


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