Expand description
Model transform constructors: orient objects in world space.
These functions produce local -> world transforms (object rotation and translation).
Unlike view transforms, model transforms take explicit local axis parameters
(fwd_axis and up_axis) because object conventions vary:
| Engine / Convention | fwd_axis | up_axis |
|---|---|---|
| Bevy / OpenGL | DVec3::NEG_Z | DVec3::Y |
| Unreal Engine | DVec3::X | DVec3::Z |
| Unity / glTF | DVec3::Z | DVec3::Y |
| Blender | DVec3::Y | DVec3::Z |
fwd_axis and up_axis must be perpendicular.
look_to_* functions target a forward direction (dir), look_at_* functions
target a focal point (center). Functions returning DMat4, DAffine3,
or similar return a full model transform (rotation and translation). Functions returning
DQuat, DMat3, or similar return only the model rotation.
§Example
use glam::DVec3;
use glam::dcamera::model;
// Bevy: object faces -Z, up is Y
let q = model::look_to_quat(DVec3::X, DVec3::Y, DVec3::NEG_Z, DVec3::Y);
assert!((q * DVec3::NEG_Z - DVec3::X).length() < 1e-6);Functions§
- look_
at_ affine3 - Returns an
DAffine3model transform from eye, focal point, and up. - look_
at_ mat3 - Returns a
DMat3model rotation from eye, focal point, and up. - look_
at_ mat4 - Returns a
DMat4model transform from eye, focal point, and up. - look_
at_ quat - Returns a
DQuatmodel rotation from eye, focal point, and up. - look_
to_ affine3 - Returns an
DAffine3model transform from eye, forward direction, and up. - look_
to_ mat3 - Returns a
DMat3model rotation from forward direction and up. - look_
to_ mat4 - Returns a
DMat4model transform from eye, forward direction, and up. - look_
to_ quat - Returns a
DQuatmodel rotation from forward direction and up.