🧰
Developer
  • ENGAGE SDK overview
  • Setting up the ENGAGE SDK
    • Registering as an ENGAGE developer
    • Setting up your local git repository
    • Installing the Unity Editor
    • Opening the ENGAGE SDK Unity project
    • Checking for SDK updates
    • Installing a platform build module
  • ENGAGE SDK project folders
  • General guidelines for 3D models
    • Optimizing 3D models
  • Locations
    • Guidelines for locations
    • Creating a new location
    • Building a location bundle
    • Testing a location locally on Windows
    • Configuring an object as a teleport target
    • Configuring the start position
    • Seats
      • Creating a seat
      • Using the summon to seat system
    • Network states
      • Network State Manager
      • Location Network States
      • Example network state configurations
        • Network state toggle object
        • Network state animation start/stop
        • Network state change animation
          • Creating an animation in Unity
          • Using Animator.Play(string)
          • Defining Animator transitions
          • Using Animator.SetTrigger(string)
        • Network state sync animation
        • Network state position toggle
        • Network state automatic door
        • Network state toggle skybox
        • Network state change materials
    • Adding grabable objects to a location
      • Resetting network objects with a button
      • Resetting network objects when out of bounds
    • Locations reference information
      • Basic requirements for a location
  • Immersive Effects (IFX)
    • Guidelines for IFX
    • Creating an IFX
    • Building an IFX bundle
    • Testing IFX locally on Windows
    • Specialized IFX
      • Animated IFX
        • Animation overrides
          • Legacy animations
          • Animator animations
          • Configuring additional Effect Life Run Control properties
      • Audio IFX
      • Interactive IFX
  • List of available prefabs
  • Available scripts
    • External Video Player
  • Profiling
  • Publishing to ENGAGE
    • Publishing checklists
    • Pushing files to your GitHub repository
  • AFX
    • Getting started
      • Changelog
    • AFX Graphs
      • Creating an AFX graph
      • Editing an AFX graph
      • Navigation and keyboard shortcuts
      • Adding an AFX graph to a game object
      • Nodes
      • Ports
      • Connections
      • Flows
        • Starting a flow
        • Using multiple flows
        • Chaining flows
        • Controlling flows
      • References
      • Using AFX Events
    • Networking AFX
      • Network State Modules
      • Ownership of networked objects
    • Animation curves
    • Node dictionary
      • ENGAGE
        • AFX Companion
          • Constant Collision
          • Grab Object
          • PathData
        • Networking
          • Network State Modules
        • Physics
        • Player
        • Seat
      • Events
        • Collision
        • Unity
        • AFX Events
      • Flow
      • Reference
      • Unity
        • Component
          • Animation
            • Set Parameters
          • Audio
            • Audio Reverb Zone
            • Audio Source
          • Collider
          • FX
          • Rendering
            • Camera
            • Light
            • Material
          • UI
        • Constraint
        • GameObject
        • Input
        • Physics
          • Raycast
            • Layer Mask
          • RigidBody
            • Joint
              • Hinge
              • Spring
          • Wheel Collider
        • Time
        • Transform
          • Get
          • Set
          • Space Switching
      • Variable
        • Bool
        • Comparison
        • Float
        • Int
        • List
        • Math
          • MathF
        • String
        • Unity Component
        • Vector
          • Quaternion
          • Vector2
          • Vector 3
            • Vector3 Math
    • Sample graphs
Powered by GitBook
On this page
  • Abs
  • Approximately
  • Clamp
  • Cos
  • Lerp
  • Lerp Angle
  • Max
  • Min
  • Move Towards
  • Move Towards Angle
  • Sign
  • Sin
  • Smooth Damp
  • Smooth Damp Angle
  • Smooth Step
  • Tan
  1. AFX
  2. Node dictionary
  3. Variable
  4. Math

MathF

PreviousMathNextString

Last updated 7 months ago

Abs

Outputs the absolute, i.e. non-negative, value of A.

Inputs:

Name
Type
Description

A

Float or Int

The initial value.

Outputs:

Name
Type
Description

Output

Float or Int

If A is positive, the output is A. If A is negative, the output is 0-A. The type of the output matches the input.

Approximately

Compares two floating point values and outputs true if they're very close in value.

Floating point operations can introduce a very small level of imprecision. You can use this node to make allowance for that imprecision. For more information, refer to in the Unity documentation.

Inputs:

Name
Type
Description

A

Float [editable]

The first number to compare.

B

Float [editable]

The second number to compare.

Outputs:

Name
Type
Description

Output

Boolean

True if A is equal to B ± the smallest value that can be represented by a floating point number.

Clamp

Applies restrictions to a value so that it remains within a set range.

Inputs:

Name
Type
Description

Value

Float or Int

The value to clamp.

Min

Float or Int

The maximum allowed value.

Max

Float or Int

The minimum allowed value.

Outputs:

Name
Type
Description

Output

Float or Int

If Value is between Min and Max, returns Value. If Value is less than Min, returns Min. If Value is greater than Max, returns Max. The type of the output matches the input.

Cos

Applies the cosine trigonometric function.

Inputs:

Name
Type
Description

Input

Float [editable]

Angle in radians.

Outputs:

Name
Type
Description

Output

Float

The cosine of the input angle.

Lerp

Outputs a linear interpolation between two input values. For example, if T=0.5, the output is a value half way between A and B.

Inputs:

Name
Type
Description

A

Float [editable]

The start value.

B

Float [editable]

The end value.

T

Float [editable]

The interpolation value between A and B. In a range between 0 and 1.0.

Outputs:

Name
Type
Description

Output

Float

The interpolated value between A and B.

Lerp Angle

Outputs a linear interpolation between two input angles. For example, if T=0.5, the output is an angle half way between A and B.

Inputs:

Name
Type
Description

A

Float [editable]

The start angle, in degrees.

B

Float [editable]

The end angle, in degrees.

T

Float [editable]

The interpolation value between A and B. In a range between 0 and 1.0.

Outputs:

Name
Type
Description

Output

Float

The interpolated value between A and B.

Max

Outputs the largest of the input values.

Inputs:

Name
Type
Description

A

Float or Int

A value to compare.

B

Float or Int

A value to compare.

Outputs:

Name
Type
Description

Output

Float or Int

The largest of A and B.

Min

Outputs the smallest of the input values.

Inputs:

Name
Type
Description

A

Float or Int

A value to compare.

B

Float or Int

A value to compare.

Outputs:

Name
Type
Description

Output

Float or Int

The smallest of A and B.

Move Towards

Moves a current value towards a target value. The change to Current will not exceed Max Delta.

If you set Max Delta to a negative value, the current value is moved away from the target value.

Inputs:

Name
Type
Description

Current

Float [editable]

The current value.

Target

Float [editable]

The value to move towards.

Max Delta

Float [editable]

The maximum change applied to the current value.

Outputs:

Name
Type
Description

Output

Float

An adjusted value of Current that's advanced towards Target. In most cases, Output = Current + Max Delta.

Move Towards Angle

Moves a current angle towards a target angle. The change to Current will not exceed Max Delta.

Inputs:

Name
Type
Description

Current

Float [editable]

The current angle.

Target

Float [editable]

The angle to move towards.

Max Delta

Float [editable]

The maximum change applied to the current angle.

Outputs:

Name
Type
Description

Output

Float

An adjusted value of Current that's advanced towards Target. In most cases, Output = Current + Max Delta.

Sign

Outputs an number that indicates whether the input is positive or negative.

Inputs:

Name
Type
Description

Input

Float [editable]

The number to evaluate.

Outputs:

Name
Type
Description

Output

Float

If Input >= 0, the output is 1. If Input < 0, the output is -1.

Sin

Applies the sine trigonometric function.

Inputs:

Name
Type
Description

Input

Float [editable]

Angle in radians.

Outputs:

Name
Type
Description

Output

Float

The sine of the input angle.

Smooth Damp

Inputs:

Name
Type
Description

Current

Float [editable]

The current value.

Target

Float [editable]

The target value.

Smooth Time

Float [editable]

The approximate time it takes for the current value to reach the target value.

Outputs:

Name
Type
Description

Output

Float

The adjusted value.

Current Velocity

Float

The calculated increment that will advance the Current value to the Target value in the specified Smooth Time.

Smooth Damp Angle

Inputs:

Name
Type
Description

Current

Float [editable]

The current angle.

Target

Float [editable]

The target angle.

Smooth Time

Float [editable]

The approximate time it takes for the current angle to reach the target angle.

Outputs:

Name
Type
Description

Output

Float

The adjusted angle.

Current Velocity

Float

The calculated increment that will advance the Current angle to the Target angle in the specified Smooth Time.

Smooth Step

Interpolates between From and To with smoothing at the limits. The interpolation will gradually speed up from the start and slow down toward the end.

Inputs:

Name
Type
Description

From

Float [editable]

Start value.

To

Float [editable]

End value.

T

Float [editable]

The interpolation value between From and To. In a range between 0 and 1.0.

Outputs:

Name
Type
Description

Output

Float

The interpolated value between From and To.

Tan

Applies the tangent trigonometric function.

Inputs:

Name
Type
Description

Input

Float [editable]

Angle in radians.

Outputs:

Name
Type
Description

Output

Float

The tangent of the input angle.

Gradually moves the current value towards a target value, over a specified time. For more information, refer to in the Unity documentation.

Gradually changes an angle given in degrees towards a desired goal angle over time. For more information, refer to in the Unity documentation.

Mathf.Approximately
Mathf.SmoothDamp
Mathf.SmoothDampAngle