parent to camera

This commit is contained in:
Asuro
2025-03-27 22:38:31 +01:00
parent 90d4c3df1b
commit 26ba03b7fe
4 changed files with 29 additions and 27 deletions

View File

@@ -37,7 +37,7 @@ void Transform::TranslateLocal(Vec3 offset)
Position = bx::add(Position, {localOffset.x, localOffset.y, localOffset.z});
}
void Transform::Rotate(bx::Vec3 rotation)
void Transform::Rotate(Vec3 rotation)
{
float rot[16]{0};
bx::mtxRotateXYZ(rot, rotation.x, rotation.y, rotation.z);
@@ -46,7 +46,7 @@ void Transform::Rotate(bx::Vec3 rotation)
bx::memCopy(Rotation.M, temp, sizeof(temp));
}
void Transform::RotateLocal(bx::Vec3 rotation)
void Transform::RotateLocal(Vec3 rotation)
{
float rot[16]{0};
bx::mtxRotateXYZ(rot, rotation.x, rotation.y, rotation.z);
@@ -135,7 +135,7 @@ Vec3 Transform::GlobalToLocalDirection(Vec3 global)
bx::vec4MulMtx(out, in, MI.M);
return {out[0], out[1], out[2]};
}
bx::Vec3 Transform::GlobalToLocalPoint(bx::Vec3 global)
bx::Vec3 Transform::GlobalToLocalPoint(Vec3 global)
{
UpdateMatrix();
float in[4]{global.x, global.y, global.z, 1.0f};
@@ -152,7 +152,7 @@ Vec3 Transform::LocalToGlobalDirection(Vec3 local)
bx::vec4MulMtx(out, in, test.M);
return {out[0], out[1], out[2]};
}
bx::Vec3 Transform::LocalToGlobalPoint(bx::Vec3 local)
bx::Vec3 Transform::LocalToGlobalPoint(Vec3 local)
{
UpdateMatrix();
float in[4]{local.x, local.y, local.z, 1.0f};