Physics Actors and Shapes
Actor Static: static actor, such as baffles, etc.
Actor Dynamic: dynamic actor, such as movable boxes
Trigger: trigger
Actor-Kinematic: violates physical principles, is determined by design, does not follow real physical principles,
anti-physical objects can easily lead to a lot of mathematical operations problem appear
Triangle Meshes generally only allow static objects to be used
Height Fields are usually used for terrain
Shape attributes:
1. Mass, density
2. Center of mass (vehicle system, center of mass is the key point)
3. Physical material: friction, elasticity
Force: force
impulse; force multiplied by time
Movement
There is no external force, uniform motion.
Acceleration is directly proportional to the size of the force and inversely proportional to the mass of the object.
Changing force
Euler method: Display Euler integrals. Relatively simple, but energy is not conserved and cannot converge.
Implicit Euler method: use future forces to solve inversely. Energy will decay, but due to the existence of friction and air resistance, the decay of energy is usually not felt.
Semi-implicit Euler method: Use the current force to find the future speed according to Newton's second law, and then use the speed to find the distance. (i.e. the force is assumed to be constant). Generally relatively stable. However, for simple harmonic motion, cos, sin, etc., the calculated period will be slightly longer than the actual period. causing phase difference
Rigid Body Dynamics: Rigid body dynamics
R: rotation attitude (matrix, quaternion)
w: angular velocity
a: angular acceleration
I: moment of inertia
L: angular momentum
t: moment arm
Application:
The force in the blue direction is decomposed into a force directed towards the center of mass and pointing tangential force
Particle dynamics: energy conservation, the motion of the center of mass must still be consistent with the direction of the blue force Torque
: form angular impulse, divide the angular impulse by the moment of inertia to get the angular velocity, that is, the rotational speed Preliminary
screening: AABB-box, follow Some boxes with the same axis direction can quickly calculate whether they can collide.
Step 2: Specifically calculate the exact collision point, collision direction, and collision depth.
Broad phase:
1.BVH Tree
2.sort and sweep
convex hull collision detection: Minkovsky subtraction ,GJK algorithm
Separating axis theorem
Raycast
sweep
overlap
Collision grouping
CCD: Set a safe distance. When the safe distance is exceeded, a denser step size detection will be performed. Prevent direct passage through objects between two steps