mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-16 18:01:40 +00:00
Use matrix4::getRotationRadians
This commit is contained in:
parent
b6c71b2379
commit
d74af2f1a7
10 changed files with 34 additions and 28 deletions
|
@ -124,13 +124,13 @@ bool boxLineCollision(const aabb3f &box, const v3f start,
|
|||
return false;
|
||||
}
|
||||
|
||||
bool boxLineCollision(const aabb3f &box, const v3f rotation,
|
||||
const v3f start, const v3f dir,
|
||||
bool boxLineCollision(const aabb3f &box, v3f rotation_radians,
|
||||
v3f start, v3f dir,
|
||||
v3f *collision_point, v3f *collision_normal, v3f *raw_collision_normal)
|
||||
{
|
||||
// Inversely transform the ray rather than rotating the box faces;
|
||||
// this allows us to continue using a simple ray - AABB intersection
|
||||
core::quaternion rot(rotation * core::DEGTORAD);
|
||||
core::quaternion rot(rotation_radians);
|
||||
rot.makeInverse();
|
||||
|
||||
bool collision = boxLineCollision(box, rot * start, rot * dir, collision_point, collision_normal);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue