mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-02 17:57:59 +03:00
Fix footprint rotations
This commit is contained in:
parent
64f1be7c37
commit
46aa7c3554
2 changed files with 10 additions and 8 deletions
|
@ -122,7 +122,10 @@ void AddFootprint(ITEM_INFO* item)
|
|||
GetLaraJointPosition(&position, LM_RFOOT);
|
||||
|
||||
auto fx = sound_effects::SFX_TR4_LARA_FEET;
|
||||
auto floor = GetCollisionResult(position.x, position.y, position.z, item->roomNumber).BottomBlock;
|
||||
auto result = GetCollisionResult(position.x, item->pos.yPos - STEP_SIZE, position.z, item->roomNumber);
|
||||
auto floor = result.BottomBlock;
|
||||
|
||||
position.y = result.Position.Floor - 4;
|
||||
|
||||
switch (floor->Material)
|
||||
{
|
||||
|
@ -191,12 +194,11 @@ void AddFootprint(ITEM_INFO* item)
|
|||
|
||||
auto plane = floor->FloorCollision.Planes[floor->SectorPlane(position.x, position.z)];
|
||||
|
||||
auto x = Vector2(plane.x * WALL_SIZE, WALL_SIZE);
|
||||
auto z = Vector2(WALL_SIZE, plane.y * WALL_SIZE);
|
||||
|
||||
auto xRot = FROM_RAD(atan2(0 - x.y, 0 - x.x));
|
||||
auto yRot = item->pos.yRot;
|
||||
auto zRot = FROM_RAD(atan2(0 - z.y, 0 - z.x));
|
||||
auto yRot = item->pos.yRot + ANGLE(180);
|
||||
auto c = phd_cos(yRot);
|
||||
auto s = phd_sin(yRot);
|
||||
auto xRot = FROM_RAD(plane.x * s + plane.y * c);
|
||||
auto zRot = FROM_RAD(plane.y * s - plane.x * c);
|
||||
|
||||
auto footprintPosition = PHD_3DPOS(position.x, position.y, position.z, xRot, yRot, zRot);
|
||||
|
||||
|
|
|
@ -611,7 +611,7 @@ namespace TEN::Renderer
|
|||
|
||||
if (footprint.active && g_Level.Sprites.size() > spriteIndex)
|
||||
{
|
||||
Matrix rot = Matrix::CreateRotationY(TO_RAD(footprint.pos.yRot) + PI);
|
||||
Matrix rot = Matrix::CreateFromYawPitchRoll(TO_RAD(footprint.pos.yRot), TO_RAD(footprint.pos.xRot), TO_RAD(footprint.pos.zRot));
|
||||
Vector3 p1 = Vector3(-64, 0, -64);
|
||||
Vector3 p2 = Vector3(64, 0, -64);
|
||||
Vector3 p3 = Vector3(64, 0, 64);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue