This is a spec for a physics implementation based on ODE.
Every shape has 2 pointers pointing to previous and next shape.
Some methods (testPlane, transform, computeAabb, accept) will have to propagade to the next shape and so on. The pure virtuals will have to change names everywhere to xxxSingle (eg testPlaneSingle) and the CollisionShape will have the xxx names. The CollisionShape::testPlane for example will propagade to this and the children.
Assertions will make sure that the methods start from the root shape.
Add copy constructor and call this in derived classes. Assert if trying to copy compound.
The Frustum will look like:
virtual CollisionShape& getCollisionShape() = 0;
Bool insideFrustum(const CollisionShape& b) const;
virtual void computeProjectionMatrix(Mat4& m) const = 0;
virtual void setTransform(const Transform& trf) = 0;
void transformPlanes(const Transform& trf);
Transform m_trf;
F32 m_near;
F32 m_far;
Plane m_planes[6];
The PerspectiveFrustum will look like:
F32 m_fovX;
F32 m_fovY;
Ray m_rays[4]; // Compound
Optimize setTransform(). There is no need to recalculate.
dxGeom:
dxConvex:
dxSphere:
dxBox:
dxPlane
dxCylinded:
The source tree is:
-- src
|-- math
|-- collision
|-- physics
PhysicsWorld
init
destroy
castRay
RigidBody : type, init_data_union setPosition setRotation getPosition getRotation getMoveUpdateTimestamp addForce
CharacterController