5 this->
position =
object->GetTransform()->GetPosition();
41 float fellingSpeed = vDiff.
DotProduct(direction);
43 if (fellingSpeed >= 0) {
50 float speed1 = (2 * mass2 * fellingSpeed) / (mass1 + mass2);
51 float speed2 = (fellingSpeed * (mass2 - mass1)) / (mass1 + mass2);
Defines the BoundarySphere class for simulating spherical boundary objects.
Represents a spherical boundary object for motion and collision simulations.
void Update(float dT, Vector3D acceleration, Quaternion rotation)
Updates the sphere's position and velocity based on acceleration and rotation.
BoundarySphere(Object3D *object, float radius)
Constructs a BoundarySphere with a given object and radius.
Object3D * object
Pointer to the 3D object associated with the sphere.
Vector3D velocity
Velocity vector of the sphere.
float radius
Radius of the sphere.
bool IsIntersecting(BoundarySphere *bO)
Checks if the sphere intersects with another BoundarySphere.
Vector3D position
Current position of the sphere.
float GetRadius()
Gets the radius of the sphere.
void Collide(float elasticity, BoundarySphere *bO)
Resolves collision between this sphere and another BoundarySphere.
Object3D * GetObject3D()
Gets the associated Object3D of the sphere.
Quaternion previousRotation
Previous rotation of the sphere.
Represents a 3D object with geometry, material, and transformation data.
A mathematical construct representing a rotation in 3D space.
Quaternion MultiplicativeInverse() const
Returns the multiplicative inverse of this quaternion, such that q * q^-1 = identity.
Vector2D RotateVector(const Vector2D &v) const
Rotates a 2D vector by this quaternion, projecting it in 2D.
Quaternion Multiply(const Quaternion &quaternion) const
Multiplies (composes) this quaternion with another (order matters).
Represents a 3D vector (X, Y, Z) and provides methods for vector arithmetic.
Vector3D Constrain(const float &minimum, const float &maximum) const
Constrains each component of this vector between two scalar bounds.
float DotProduct(const Vector3D &vector) const
Computes the dot product of this vector with another Vector3D.