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

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

Inheritance diagram for MoreMountains.Tools.MMPreventPassingThrough:

Public Attributes

LayerMask ObstaclesLayerMask
 the layer mask to search obstacles on More...
 
float SkinWidth = 0.1f
 the bounds adjustment variable More...
 

Protected Member Functions

virtual void Start ()
 On Start we initialize our object More...
 
virtual void Initialization ()
 Grabs the rigidbody and computes the bounds width 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 _smallestBoundsWidth
 
float _adjustedSmallestBoundsWidth
 
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 Function Documentation

◆ FixedUpdate()

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

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

◆ Initialization()

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

Grabs the rigidbody and computes the bounds width

◆ OnEnable()

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

On Enable, we initialize our last frame position

◆ Start()

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

On Start we initialize our object

Member Data Documentation

◆ _adjustedSmallestBoundsWidth

float MoreMountains.Tools.MMPreventPassingThrough._adjustedSmallestBoundsWidth
protected

◆ _collider

Collider MoreMountains.Tools.MMPreventPassingThrough._collider
protected

◆ _lastMovement

Vector3 MoreMountains.Tools.MMPreventPassingThrough._lastMovement
protected

◆ _lastMovementSquared

float MoreMountains.Tools.MMPreventPassingThrough._lastMovementSquared
protected

◆ _positionLastFrame

Vector3 MoreMountains.Tools.MMPreventPassingThrough._positionLastFrame
protected

◆ _rigidbody

Rigidbody MoreMountains.Tools.MMPreventPassingThrough._rigidbody
protected

◆ _smallestBoundsWidth

float MoreMountains.Tools.MMPreventPassingThrough._smallestBoundsWidth
protected

◆ _squaredBoundsWidth

float MoreMountains.Tools.MMPreventPassingThrough._squaredBoundsWidth
protected

◆ ObstaclesLayerMask

LayerMask MoreMountains.Tools.MMPreventPassingThrough.ObstaclesLayerMask

the layer mask to search obstacles on

◆ SkinWidth

float MoreMountains.Tools.MMPreventPassingThrough.SkinWidth = 0.1f

the bounds adjustment variable


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