Added set_position_rotation_scale procedures

This commit is contained in:
2024-12-02 23:36:35 +01:00
parent e7522f9c55
commit 71668cc2f5
3 changed files with 68 additions and 4 deletions

View File

@@ -166,6 +166,17 @@ set_scale :: (transform: *Transform, scale: float, calculate_matrix: bool = true
if calculate_matrix update_matrix(transform);
}
set_position_rotation_scale :: (transform: *Transform, position: Vector3, rotation: Quaternion, scale: Vector3, calculate_matrix: bool = true) {
transform.position = position;
transform.orientation = rotation;
transform.scale = scale;
if calculate_matrix update_matrix(transform);
}
set_position_rotation_scale :: (e: *Entity, position: Vector3, rotation: Quaternion, scale: Vector3, calculate_matrix: bool = true) {
set_position_rotation_scale(*e.transform, position, rotation, scale, calculate_matrix);
}
get_forward :: (transform: Transform) -> Vector3 {
v := rotation_matrix(Matrix4, transform.orientation) * Vector4.{0,0,1,0};
return .{v.x, v.y, v.z};