What: Transform usage in movement animations
Time To Complete: 1-16 hours
Transform computes the position, rotation and scale of an object.
Every object in a Scene has a Transform. It's used to store and manipulate the position, rotation and scale of the object. Every Transform can have a parent, which allows you to apply position, rotation and scale hierarchically. This is the hierarchy seen in the Hierarchy pane.
In the companion Unity project called Week2_Transforms_csharp check the folder Scenes in the Project folder lower left bottom of the Unity Editor:

The blue-ish highlighted items in the Unity Editor's top left Hierarchy Pane, serves as an example of Transform Hierarchy:





//Class Members
public GameObject creature;
public float radius;
float t;
public float h;
//Class Function
void Update()
{
float c = 0f;
...
creature.transform.position = new Vector3(
radius * Mathf.Cos(t),
creature.transform.position.y + h*Time.deltaTime*c,
radius * Mathf.Sin(t)
);
...
}
creature: Manta Ray the GameObject to animate
radius: radius of circling
t: time, in unit of seconds (with decimal fractions), that is used to time-Parametrize the movements of the creature
h: delta or incremental increase/decrease of height (Y in unity, Z in Mathematics) as circling to trek along a Helical trajectory
The interval in seconds from the last frame to the current one (Read Only).
Time.deltaTime is customarily used for local GameObject animations. Pay special attention to its many uses!
Discrete time views values of variables as occurring at distinct, separate "points in time", or equivalently as being unchanged throughout each non-zero region of time ("time period")—that is, time is viewed as a discrete variable.
See Also:
https://en.wikipedia.org/wiki/Discrete_time_and_continuous_time
In computer graphics or in any gaming or simulation or animation application Time is treated as a Discrete Variable or as Discrete Time.
Mathf is the mathematics Class in Unity and foo ranges over many functions from Cos, Sin to Abs.
See Also:
https://docs.unity3d.com/2023.2/Documentation/ScriptReference/Mathf.html
In the case of the Manta Ray the creature has its own inherent 3D animations including the flappig of the large wings or waving the tail.
These animations normally appear in the localspace of the object and the animation results no net motion!
Building on top of these localspace, one could add global motions across the landscapes of the scene which is often under the control of the player.
For Manta Ray we added simple Helical parametric equations of motions on top of the creature's own intrinsic animations.
/*
Parametric equations of motion:
x = cos(t)
y = y + h*dt*c
z = sin(t)
or in vector notation
(x(t),y(t),z(t))=(cos(t), y(t-dt) + h*dt*c, sin(t))
*/
creature.transform.position = new Vector3(
radius * Mathf.Cos(t),
creature.transform.position.y + h*Time.deltaTime*c,
radius * Mathf.Sin(t)
);
In physics, equations of motion are equations that describe the behavior of a physical system in terms of its motion as a function of time.More specifically, the equations of motion describe the behavior of a physical system as a set of mathematical functions in terms of dynamic variables. These variables are usually spatial coordinates and time...
See Also:
https://en.wikipedia.org/wiki/Equations_of_motion
In mathematics, a parametric equation defines a group of quantities as functions of one or more independent variables called parameters. Parametric equations are commonly used to express the coordinates of the points that make up a geometric object such as a curve or surface, called parametric curve and parametric surface, respectively.