diff --git a/source/platform/pbranch.cpp b/source/platform/pbranch.cpp index 5a082b208..83c94163f 100644 --- a/source/platform/pbranch.cpp +++ b/source/platform/pbranch.cpp @@ -303,10 +303,7 @@ int CNpcBranchPlatform::getHeightFromPlatformAtPosition(int _x,int _y, int offse top.vx = offsetX + collisionArea.x1; } - //sBBox boundingBox = m_modelGfx->GetBBox(); - sBBox boundingBox = getBBox(); - //top.vy = collisionArea.y1; - top.vy = boundingBox.YMin + Pos.vy + offsetY; + top.vy = offsetY + collisionArea.y1; angle=getCollisionAngle(); if(angle==0) @@ -317,7 +314,6 @@ int CNpcBranchPlatform::getHeightFromPlatformAtPosition(int _x,int _y, int offse else { // Rotate backwards to find height at current position - //return( ( top.vy - _y ) + ( ( top.vx - _x ) * msin( -angle & 4095 ) >> 12 ) ); int hypotenuse = ( ( top.vx - _x ) << 12 ) / rcos( angle ); diff --git a/source/platform/platform.cpp b/source/platform/platform.cpp index cd9748962..f62cdd2ba 100644 --- a/source/platform/platform.cpp +++ b/source/platform/platform.cpp @@ -1075,23 +1075,29 @@ int CNpcPlatform::getHeightFromPlatformAtPosition(int _x,int _y, int offsetX, in int angle; CRECT collisionArea = getCollisionArea(); - top.vx = offsetX + ( ( collisionArea.x1 + collisionArea.x2 ) >> 1 ); - //sBBox boundingBox = m_modelGfx->GetBBox(); sBBox boundingBox = getBBox(); - //top.vy = collisionArea.y1; - top.vy = boundingBox.YMin + Pos.vy + offsetY; + top.vy = offsetY + collisionArea.y1; angle=getCollisionAngle(); if(angle==0) { // Non-rotated platform + return( top.vy - _y ); } else { + if ( angle > 0 ) + { + top.vx = offsetX + collisionArea.x1; + } + else + { + top.vx = offsetX + collisionArea.x2; + } + // Rotate backwards to find height at current position - //return( ( top.vy - _y ) + ( ( top.vx - _x ) * msin( -angle & 4095 ) >> 12 ) ); int hypotenuse = ( ( top.vx - _x ) << 12 ) / rcos( angle );