44 bMS->Randomize(1500.0f);
57 long currentTime = micros();
58 float dT = (float)(currentTime -
previousTime) / 1000000.0f;
62 bMS->Update(dT, accelNormalized, rotation);
64 for (
int i = 0; i < 12; i++) {
65 float positionZ =
objects[i]->GetTransform()->GetPosition().Z;
68 objects[i]->GetTransform()->SetScale(
Vector3D(scaleRatio, scaleRatio, scaleRatio));
Defines the PhysicsSimulator class for managing physics simulations within a scene.
Simulates motion and collision interactions between a BoundaryCube and multiple BoundarySpheres.
static T Map(T value, T inLow, T inMax, T outMin, T outMax)
Maps a value from one range to another.
BoundaryMotionSimulator * bMS
Simulator handling boundary object interactions.
long previousTime
Time of the previous simulation update.
PhysicsSimulator()
Default constructor initializes the PhysicsSimulator.
BoundaryCube bC
Boundary cube to contain and interact with objects.
Scene * scene
Scene containing objects and their dynamics.
Scene * GetScene()
Retrieves the scene managed by the simulator.
Object3D * objects[12]
Array of objects in the simulation.
void Update(Vector3D acceleration, Quaternion rotation)
Updates the simulation with new acceleration and rotation values.
Light lights[6]
Array of lights illuminating the scene.
bool startedSim
Indicates if the simulation has started.
A mathematical construct representing a rotation in 3D space.
Manages a collection of 3D objects and applies optional screen-space effects.
Represents a 3D vector (X, Y, Z) and provides methods for vector arithmetic.
float Z
The Z-component of the 3D vector.
float X
The X-component of the 3D vector.
float Y
The Y-component of the 3D vector.