Skip to content

cf_transform_to_b2

Category: physics
GitHub: cute_physics.h


Converts a CF_Transform to a b2Transform.

b2Transform cf_transform_to_b2(CF_Transform tf) { b2Transform out; out.p = cf_v2_to_b2(tf.p); out.q = cf_sincos_to_b2(tf.r); return out; }

Remarks

Both field order (rotation/position) and rotation layout differ -- always convert, never cast. The typical direction is the other way: pull a body's b2Body_GetTransform through cf_b2_to_transform for rendering.

cf_b2_to_transform
cf_sincos_to_b2
cf_v2_to_b2