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

This feedback will let you animate the scale of the target object over time, with a spring + squash and stretch effect More...

Inheritance diagram for MoreMountains.Feedbacks.MMF_SquashAndStretchSpring:
MoreMountains.Feedbacks.MMF_Feedback

Public Types

enum  Modes { Modes.MoveTo, Modes.MoveToAdditive, Modes.Bump }
 
enum  PossibleAxis {
  PossibleAxis.XtoYZ, PossibleAxis.XtoY, PossibleAxis.XtoZ, PossibleAxis.YtoXZ,
  PossibleAxis.YtoX, PossibleAxis.YtoZ, PossibleAxis.ZtoXZ, PossibleAxis.ZtoX,
  PossibleAxis.ZtoY
}
 

Public Attributes

override bool HasAutomatedTargetAcquisition => true
 sets the inspector color for this feedback More...
 
override bool CanForceInitialValue => true
 
override bool HasRandomness => true
 
Transform AnimateScaleTarget
 the object to animate More...
 
float DeclaredDuration = 0f
 spring duration is determined by the spring (and could be impacted real time), so it's up to you to determine how long this feedback should last, from the point of view of its parent MMF Player More...
 
PossibleAxis Axis = PossibleAxis.XtoYZ
 the axis on which to operate squashing and stretching More...
 
float Damping = 0.4f
 the dumping ratio determines how fast the spring will evolve after a disturbance. At a low value, it'll oscillate for a long time, while closer to 1 it'll stop oscillating quickly More...
 
float Frequency = 6f
 the frequency determines how fast the spring will oscillate when disturbed, low frequency means less oscillations per second, high frequency means more oscillations per second More...
 
Modes Mode = Modes.Bump
 the chosen mode for this spring. MoveTo will move the target the specified scale (randomized between min and max). MoveToAdditive will add the specified scale (randomized between min and max) to the target's current scale. Bump will bump the target's scale by the specified power (randomized between min and max) More...
 
float MoveToMin = 1f
 the min value from which to pick a random target value when in MoveTo or MoveToAdditive modes More...
 
float MoveToMax = 2f
 the max value from which to pick a random target value when in MoveTo or MoveToAdditive modes More...
 
float BumpScaleMin = 20f
 the min value from which to pick a random bump amount when in Bump mode More...
 
float BumpScaleMax = 30f
 the max value from which to pick a random bump amount when in Bump mode More...
 

Static Public Attributes

static bool FeedbackTypeAuthorized = true
 a static bool used to disable all feedbacks of this type at once More...
 

Protected Member Functions

override void AutomateTargetAcquisition ()
 A method meant to be implemented per feedback letting you specify what happens (usually setting a target) More...
 
override void CustomInitialization (MMF_Player owner)
 On init we store our initial scale More...
 
virtual void GetInitialValues ()
 Stores initial scale for future use More...
 
override void CustomPlayFeedback (Vector3 position, float feedbacksIntensity=1.0f)
 On Play, triggers the scale animation More...
 
virtual IEnumerator Spring ()
 a coroutine running on the Owner used to move the spring More...
 
virtual void UpdateSpring ()
 Updates the spring's values More...
 
virtual void ApplyValue ()
 Applies the current spring value to the target More...
 
override void CustomStopFeedback (Vector3 position, float feedbacksIntensity=1.0f)
 On stop, we interrupt movement if it was active More...
 
override void CustomSkipToTheEnd (Vector3 position, float feedbacksIntensity=1.0f)
 Skips to the end, matching the target value More...
 
override void CustomRestoreInitialValues ()
 On restore, we restore our initial state More...
 

Protected Attributes

float _currentValue = 0f
 
float _targetValue = 0f
 
float _velocity = 0f
 
virtual bool LowVelocity => Mathf.Abs(_velocity) < _velocityLowThreshold
 
Coroutine _coroutine
 
float _velocityLowThreshold = 0.001f
 
Vector3 _newScale
 
Vector3 _initialScale
 

Properties

override float FeedbackDuration [get, set]
 the duration of this feedback is the duration of the scale animation More...
 

Additional Inherited Members

Detailed Description

This feedback will let you animate the scale of the target object over time, with a spring + squash and stretch effect

Member Enumeration Documentation

◆ Modes

Enumerator
MoveTo 
MoveToAdditive 
Bump 

◆ PossibleAxis

Enumerator
XtoYZ 
XtoY 
XtoZ 
YtoXZ 
YtoX 
YtoZ 
ZtoXZ 
ZtoX 
ZtoY 

Member Function Documentation

◆ ApplyValue()

virtual void MoreMountains.Feedbacks.MMF_SquashAndStretchSpring.ApplyValue ( )
protectedvirtual

Applies the current spring value to the target

◆ AutomateTargetAcquisition()

override void MoreMountains.Feedbacks.MMF_SquashAndStretchSpring.AutomateTargetAcquisition ( )
protectedvirtual

A method meant to be implemented per feedback letting you specify what happens (usually setting a target)

Reimplemented from MoreMountains.Feedbacks.MMF_Feedback.

◆ CustomInitialization()

override void MoreMountains.Feedbacks.MMF_SquashAndStretchSpring.CustomInitialization ( MMF_Player  owner)
protectedvirtual

On init we store our initial scale

Parameters
owner

Reimplemented from MoreMountains.Feedbacks.MMF_Feedback.

◆ CustomPlayFeedback()

override void MoreMountains.Feedbacks.MMF_SquashAndStretchSpring.CustomPlayFeedback ( Vector3  position,
float  feedbacksIntensity = 1.0f 
)
protectedvirtual

On Play, triggers the scale animation

Parameters
position
feedbacksIntensity

Implements MoreMountains.Feedbacks.MMF_Feedback.

◆ CustomRestoreInitialValues()

override void MoreMountains.Feedbacks.MMF_SquashAndStretchSpring.CustomRestoreInitialValues ( )
protectedvirtual

On restore, we restore our initial state

Reimplemented from MoreMountains.Feedbacks.MMF_Feedback.

◆ CustomSkipToTheEnd()

override void MoreMountains.Feedbacks.MMF_SquashAndStretchSpring.CustomSkipToTheEnd ( Vector3  position,
float  feedbacksIntensity = 1.0f 
)
protectedvirtual

Skips to the end, matching the target value

Parameters
position
feedbacksIntensity

Reimplemented from MoreMountains.Feedbacks.MMF_Feedback.

◆ CustomStopFeedback()

override void MoreMountains.Feedbacks.MMF_SquashAndStretchSpring.CustomStopFeedback ( Vector3  position,
float  feedbacksIntensity = 1.0f 
)
protectedvirtual

On stop, we interrupt movement if it was active

Parameters
position
feedbacksIntensity

Reimplemented from MoreMountains.Feedbacks.MMF_Feedback.

◆ GetInitialValues()

virtual void MoreMountains.Feedbacks.MMF_SquashAndStretchSpring.GetInitialValues ( )
protectedvirtual

Stores initial scale for future use

◆ Spring()

virtual IEnumerator MoreMountains.Feedbacks.MMF_SquashAndStretchSpring.Spring ( )
protectedvirtual

a coroutine running on the Owner used to move the spring

Returns

◆ UpdateSpring()

virtual void MoreMountains.Feedbacks.MMF_SquashAndStretchSpring.UpdateSpring ( )
protectedvirtual

Updates the spring's values

Member Data Documentation

◆ _coroutine

Coroutine MoreMountains.Feedbacks.MMF_SquashAndStretchSpring._coroutine
protected

◆ _currentValue

float MoreMountains.Feedbacks.MMF_SquashAndStretchSpring._currentValue = 0f
protected

◆ _initialScale

Vector3 MoreMountains.Feedbacks.MMF_SquashAndStretchSpring._initialScale
protected

◆ _newScale

Vector3 MoreMountains.Feedbacks.MMF_SquashAndStretchSpring._newScale
protected

◆ _targetValue

float MoreMountains.Feedbacks.MMF_SquashAndStretchSpring._targetValue = 0f
protected

◆ _velocity

float MoreMountains.Feedbacks.MMF_SquashAndStretchSpring._velocity = 0f
protected

◆ _velocityLowThreshold

float MoreMountains.Feedbacks.MMF_SquashAndStretchSpring._velocityLowThreshold = 0.001f
protected

◆ AnimateScaleTarget

Transform MoreMountains.Feedbacks.MMF_SquashAndStretchSpring.AnimateScaleTarget

the object to animate

◆ Axis

PossibleAxis MoreMountains.Feedbacks.MMF_SquashAndStretchSpring.Axis = PossibleAxis.XtoYZ

the axis on which to operate squashing and stretching

◆ BumpScaleMax

float MoreMountains.Feedbacks.MMF_SquashAndStretchSpring.BumpScaleMax = 30f

the max value from which to pick a random bump amount when in Bump mode

◆ BumpScaleMin

float MoreMountains.Feedbacks.MMF_SquashAndStretchSpring.BumpScaleMin = 20f

the min value from which to pick a random bump amount when in Bump mode

◆ CanForceInitialValue

override bool MoreMountains.Feedbacks.MMF_SquashAndStretchSpring.CanForceInitialValue => true

◆ Damping

float MoreMountains.Feedbacks.MMF_SquashAndStretchSpring.Damping = 0.4f

the dumping ratio determines how fast the spring will evolve after a disturbance. At a low value, it'll oscillate for a long time, while closer to 1 it'll stop oscillating quickly

◆ DeclaredDuration

float MoreMountains.Feedbacks.MMF_SquashAndStretchSpring.DeclaredDuration = 0f

spring duration is determined by the spring (and could be impacted real time), so it's up to you to determine how long this feedback should last, from the point of view of its parent MMF Player

◆ FeedbackTypeAuthorized

bool MoreMountains.Feedbacks.MMF_SquashAndStretchSpring.FeedbackTypeAuthorized = true
static

a static bool used to disable all feedbacks of this type at once

◆ Frequency

float MoreMountains.Feedbacks.MMF_SquashAndStretchSpring.Frequency = 6f

the frequency determines how fast the spring will oscillate when disturbed, low frequency means less oscillations per second, high frequency means more oscillations per second

◆ HasAutomatedTargetAcquisition

override bool MoreMountains.Feedbacks.MMF_SquashAndStretchSpring.HasAutomatedTargetAcquisition => true

sets the inspector color for this feedback

◆ HasRandomness

override bool MoreMountains.Feedbacks.MMF_SquashAndStretchSpring.HasRandomness => true

◆ LowVelocity

virtual bool MoreMountains.Feedbacks.MMF_SquashAndStretchSpring.LowVelocity => Mathf.Abs(_velocity) < _velocityLowThreshold
protected

◆ Mode

Modes MoreMountains.Feedbacks.MMF_SquashAndStretchSpring.Mode = Modes.Bump

the chosen mode for this spring. MoveTo will move the target the specified scale (randomized between min and max). MoveToAdditive will add the specified scale (randomized between min and max) to the target's current scale. Bump will bump the target's scale by the specified power (randomized between min and max)

◆ MoveToMax

float MoreMountains.Feedbacks.MMF_SquashAndStretchSpring.MoveToMax = 2f

the max value from which to pick a random target value when in MoveTo or MoveToAdditive modes

◆ MoveToMin

float MoreMountains.Feedbacks.MMF_SquashAndStretchSpring.MoveToMin = 1f

the min value from which to pick a random target value when in MoveTo or MoveToAdditive modes

Property Documentation

◆ FeedbackDuration

override float MoreMountains.Feedbacks.MMF_SquashAndStretchSpring.FeedbackDuration
getset

the duration of this feedback is the duration of the scale animation


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