Skip to main content

Expressions and Drivers

Math Expressions

Any animatable actor property (color, radius, position, etc.) can be animated with a math expression (Similar to SFM's expression operators). The implementation is based on the high-performance exprtk library, which includes support for:

  • Logical operators (and/or/not/etc.)
  • Conditions (if/ternary/etc.)
  • Loops (for/while/etc.)
  • Vectors

InputsInputs:

  • value: The current value
  • time: The current time in seconds
  • timeIndex:
  • startOffset:
  • timescale:
  • duration:

Base FunctionsFunctions:

  • All built-in exprtk functions
  • quatnoise(float v1,float v2,float v3): Perlin noise.
  • valueAtvalueAt(int timeIndex): Returns the value at the specified time index.
  • sqr(float v):
  • ramp(float x,float a,float b)
  • cramp(float v1, float v2,float v3)
  • lerp(float x,float a,float b)
  • clerp(float 1,float v2,float v3)
  • elerp(float v1,float v2,float v3)
  • rescale(float x,float xa,float xb,float ya,float yb)
  • crescale(float v1,float v2,float v3,float v4,float v5)
  • print(...): For debugging purposes, prints the specified arguments to the console.
Quaternion Functions
  • q_from_axis_angle(float[3] axis,float angle,float[4] out)
  • q_forward(float[4] quat,float[3] out)
  • q_right(float[4] quat,float[3] out)
  • q_up(float[4] quat,float[3] out)
  • q_slerp(float[4] q0,float[4] q1,float factor,float[4] out)
  • q_lerp(float[4] q0,float[4] q1,float factor,float[4] out)
  • q_dot(float[4] q0,float[4] q1)
  • q_mul(float[4] q0,float[4] q1,float[4] out)
  • q_inverse(float[4] quatInOut)
  • float q_length(float[4] quat)

Contrary to SFM's expression operators, PFM's math expressions cannot reference anything outside of the animation channel for the property it's assigned to. To create dependencies between properties, you need to use animation drivers instead.

 

Animation Drivers

This is a placeholder.