The model origin (axes) is still at the same position.Īgx :: RigidBodyRef body = new agx :: RigidBody // Get position of Center of Mass in world coordinate system Vec3 pos = body -> getCmPosition () // Get orientation of Center of Mass in world coordinate system Quat rot = body -> getCmRotation () // Get rotation and translation of Center of Mass in world // coordinate system AffineMatrix4x4 m = body -> getCmTransform () // Or the complete frame at one call Frame * cmFrame = body -> getCmFrame () // Translation relative to model coordinate system Vec3 pos = body -> getCmFrame () -> getLocalTranslate () // In most situation, it is the model coordinate system that is interesting.
12.2: illustrates the situation after another box geometry is added to the body, and thus the center of mass (yellow sphere) is shifted along the y-axis. 12.1: shows one box with the model origin (axes) and the center of mass (yellow sphere) at the same positions.įig. Therefore AGX provides two coordinate frames, the model frame and the center of mass(CM) frame.įig. This is usually not the expected/wanted behavior. Since the center of mass moves when geometries are added (if RigidBody::getMassProperties()::getAutoGenerate()=true), it is not a practical reference when building a simulation.įor example, if a constraint is attached to a body relative to the body center of mass, adding another geometry and thereby moving the center of mass would change to attachment point for the constraint. This point can either automatically be calculated from the geometries/shapes that are associated to the rigid body, or it can also be explicitly specified to any point in space.
Modeling coordinates/Center of Mass coordinates ¶Ĭenter of mass is the point in the world coordinate system where the collected mass of a rigid body is located in space.