Unity HDRP Product Visualizer 1.0.0
Interactive 3D product showcase built with Unity 6 and HDRP
Loading...
Searching...
No Matches
ProductFloatAnimation Class Reference

Animates a GameObject with a gentle sinusoidal float and dual-axis tilt. More...

Inheritance diagram for ProductFloatAnimation:
Collaboration diagram for ProductFloatAnimation:

Public Attributes

Float
float floatAmplitude = 0.05f
 Peak vertical displacement from the rest position (metres).
 
float floatSpeed = 1.2f
 Cycles per second of the vertical sine wave.
 
Tilt
float tiltAmplitude = 2f
 Peak rotation on X and Z axes (degrees).
 
float tiltSpeed = 0.8f
 Base frequency of the tilt oscillation.
 

Detailed Description

Animates a GameObject with a gentle sinusoidal float and dual-axis tilt.

The animation runs entirely in Update() via Mathf.Sin / Mathf.Cos, requiring no Animator or AnimationClip asset. A random phase offset is assigned at Start so multiple products in the same scene do not move in sync.

Formula
Y offset = sin(time * floatSpeed) * floatAmplitude
Pitch = sin(time * tiltSpeed * 0.7) * tiltAmplitude
Roll = cos(time * tiltSpeed) * tiltAmplitude * 0.5
float floatAmplitude
Peak vertical displacement from the rest position (metres).
float tiltAmplitude
Peak rotation on X and Z axes (degrees).
float tiltSpeed
Base frequency of the tilt oscillation.
float floatSpeed
Cycles per second of the vertical sine wave.
Tuning tips
  • Keep floatAmplitude below 0.1 for a subtle, premium feel.
  • Reduce tiltAmplitude to 0 if the product should stay perfectly upright.
  • Both floatSpeed and tiltSpeed are independent so the movement never fully repeats, avoiding a mechanical look.

Definition at line 27 of file ProductFloatAnimation.cs.

Member Data Documentation

◆ floatAmplitude

float ProductFloatAnimation.floatAmplitude = 0.05f

Peak vertical displacement from the rest position (metres).

Definition at line 38 of file ProductFloatAnimation.cs.

◆ floatSpeed

float ProductFloatAnimation.floatSpeed = 1.2f

Cycles per second of the vertical sine wave.

Definition at line 41 of file ProductFloatAnimation.cs.

◆ tiltAmplitude

float ProductFloatAnimation.tiltAmplitude = 2f

Peak rotation on X and Z axes (degrees).

Definition at line 50 of file ProductFloatAnimation.cs.

◆ tiltSpeed

float ProductFloatAnimation.tiltSpeed = 0.8f

Base frequency of the tilt oscillation.

Z-axis uses this value, X-axis uses 70% of it to avoid synchronised movement.

Definition at line 54 of file ProductFloatAnimation.cs.


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