Loading...
Searching...
No Matches
AdventureCore.MovementBase Class Reference

Detailed Description

base class for movements, movements determine how and where a character moves
these will be where player or enemy ai input is sent to move the character
this base mainly defines standardized ways for other systems like actions to interfere with movement
for example a common use is for actions to suspend the actual movement logic and the animator to send root motion movement

https://adventure.softleitner.com/manual/movement

Inheritance diagram for AdventureCore.MovementBase:
AdventureCore.ManualMovement AdventureCore.MovementBasePersisted AdventureCore.CharacterControllerMovement AdventureCore.NavMeshAgentMovement

Public Member Functions

virtual Quaternion GetOffsetRotation (float horizontal, float vertical)
 
virtual void SetTarget (Component component)
 
virtual void SetTarget (Transform transform)
 
virtual void ResetInput ()
 resets current input to the model direction(for example when coming out of an animation)
 
virtual void ResetMomentum ()
 resets the movements momentum(gravity, velocity)
 
virtual void Align (Vector3 direction)
 quickly aligns the movement with a give direction
 
virtual void AlignToInput ()
 quickly aligns the movement with the input direction(in between rolls for example)
 
virtual void AlignToTarget ()
 quickly aligns the movement with its Target, this may be a locked on enemy or the target an AI is following
 
virtual void KeepAligned (Vector3 direction)
 keeps the movement aligned with a give direction
 
virtual void KeepAlignedToInput ()
 keeps the movement aligned with the input direction
 
virtual void KeepAlignedToTarget ()
 keeps the movement aligned with its Target, this may be a locked on enemy or the target an AI is following
 
virtual void StartMarch ()
 
virtual bool AdvanceMarch (Vector3 a, Vector3 b, float normalizedTime, float deltaTime, float multiplier=1f)
 
virtual bool AdvanceMarch (Vector3 target, float deltaTime, float multiplier=1f)
 
virtual void EndMarch ()
 
virtual void TeleportCharacter (Transform transform)
 instantly moves the character to a transform
 
virtual void TeleportCharacter (Vector3 position, Quaternion rotation)
 instantly moves the character
 
virtual void MoveCharacter (Transform transform)
 quickly moves the movement to the passed transform
 
virtual void MoveCharacter (Vector3 position, Quaternion rotation)
 
virtual void PropelCharacterLocal (Vector3 value)
 
virtual void PropelCharacter (Vector3 value)
 
virtual void ApplyRootMotion (Animator animator)
 
void SetPersisted (Transform transform)
 
virtual void SetPersisted (Vector3 position, Quaternion rotation)
 

Protected Member Functions

virtual IEnumerator moveCharacter (Vector3 position, Quaternion rotation)
 
virtual IEnumerator align (float target, Action finished=null, bool waitForEndOfFrame=false)
 
virtual void keepAligned (float rotation)
 

Static Protected Member Functions

static IEnumerator tween (Action< float > change, Action finished, float duration, bool waitForEndOfFrame=false)
 

Properties

virtual bool IsTranslationSuspended [get, set]
 means that no translation should be applied by the movement
 
virtual bool IsRotationSuspended [get, set]
 means that no rotation should be applied by the movement
 
virtual bool IsControlSuspended [get, set]
 while this is true input will have no influence on the movement(rolling for example)
 
virtual bool IsCollisionSuspended [get, set]
 suspends collision of the player with environment and such, for example when the player is moved through a tight crack by an animation or climbing a ladder
 
virtual bool IsPersistenceSuspended [get, set]
 notifies the movement that its position should not be persisted(perhaps because the area is unsafe or moving)
 
virtual float SpeedMultiplier = 1f [get, set]
 can be used to modify the movements speed from outside(for example slowed by snow or boosted by some effect)
 
virtual Vector3 MotionMultiplier = Vector3.one [get, set]
 can be used to modify the movement from root motion from outside(may be useful when characters of different sizes use the same animation)
 
virtual float SpeedFactorForward [get, protected set]
 how fast the character is moving forwards relative to its maximum speed
so 1 means full speed forward -0.5 is moving back at half speed and 2 could be a sprint forward
can be used as a parameter for walking animations and leaning according to speed
 
virtual float SpeedFactorSideways [get, protected set]
 how fast the character is moving sideways relative to its maximum speed
characters may move sideways when locked on for example
1 could mean full speed right, -0.5 half speed left
can be used as a parameter for walking animations and leaning according to speed
 
virtual bool IsGrounded = true [get, protected set]
 whether the character is currently touching the ground
useful for switching to a falling animation or to check if jumping is possible
 
virtual bool IsSprinting [get, protected set]
 whether the character is currently sprinting
 
virtual bool IsMarching [get, protected set]
 whether the character is currently marching
 
virtual bool IsMoved [get, protected set]
 whether the character is currently being forced to move using MoveCharacter(Transform)
 
virtual Transform Target [get]
 
virtual bool HasTarget [get]
 
virtual float TargetDistance [get]
 
virtual Vector3 TargetDirection [get]
 
virtual Vector3 Position [get, set]
 
virtual Quaternion Rotation [get, set]
 
virtual Vector3 Forward [get, set]
 
virtual Vector3 Right [get, set]
 
virtual Vector3 Up [get, set]
 
virtual Vector3 Direction [get]
 
virtual Vector3 Velocity [get]
 
virtual bool IsMoving [get]
 
virtual Transform RotationPivot [get]
 
virtual float AlignmentDuration [get]
 

Events

Action< Transform > TargetChanged
 

Member Function Documentation

◆ Align()

virtual void AdventureCore.MovementBase.Align ( Vector3 direction)
virtual

quickly aligns the movement with a give direction

Parameters
directiondirection the movement will end up in

◆ AlignToInput()

virtual void AdventureCore.MovementBase.AlignToInput ( )
virtual

quickly aligns the movement with the input direction(in between rolls for example)

Reimplemented in AdventureCore.CharacterControllerMovement.

◆ KeepAligned()

virtual void AdventureCore.MovementBase.KeepAligned ( Vector3 direction)
virtual

keeps the movement aligned with a give direction

Parameters
directiondirection the movement will end up in

◆ MoveCharacter()

virtual void AdventureCore.MovementBase.MoveCharacter ( Transform transform)
virtual

quickly moves the movement to the passed transform

Parameters
transform

◆ ResetInput()

virtual void AdventureCore.MovementBase.ResetInput ( )
inlinevirtual

resets current input to the model direction(for example when coming out of an animation)

Reimplemented in AdventureCore.CharacterControllerMovement.

◆ ResetMomentum()

virtual void AdventureCore.MovementBase.ResetMomentum ( )
inlinevirtual

resets the movements momentum(gravity, velocity)

Reimplemented in AdventureCore.CharacterControllerMovement.

◆ TeleportCharacter() [1/2]

virtual void AdventureCore.MovementBase.TeleportCharacter ( Transform transform)
virtual

instantly moves the character to a transform

Parameters
transformtransform the character is moved to

◆ TeleportCharacter() [2/2]

virtual void AdventureCore.MovementBase.TeleportCharacter ( Vector3 position,
Quaternion rotation )
inlinevirtual

instantly moves the character

Parameters
positionposition the character is teleported to
rotationrotation the character is teleported to

Reimplemented in AdventureCore.CharacterControllerMovement.