This commit is contained in:
parent
6874230557
commit
2c8c4fcb60
2 changed files with 47 additions and 1 deletions
|
@ -139,4 +139,49 @@ void CNpcRaftPlatform::processMovement( int _frames )
|
||||||
m_isActivated = true;
|
m_isActivated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sort out rotation
|
||||||
|
|
||||||
|
DVECTOR testPos1, testPos2;
|
||||||
|
|
||||||
|
testPos1 = testPos2 = Pos;
|
||||||
|
testPos1.vx -= 10;
|
||||||
|
testPos2.vx += 10;
|
||||||
|
|
||||||
|
testPos1.vy += CGameScene::getCollision()->getHeightFromGround( testPos1.vx, testPos1.vy, 16 );
|
||||||
|
testPos2.vy += CGameScene::getCollision()->getHeightFromGround( testPos2.vx, testPos2.vy, 16 );
|
||||||
|
|
||||||
|
s32 xDist = testPos2.vx - testPos1.vx;
|
||||||
|
s32 yDist = testPos2.vy - testPos1.vy;
|
||||||
|
|
||||||
|
s16 heading = ratan2( yDist, xDist );
|
||||||
|
|
||||||
|
setCollisionAngle( heading );
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void CNpcRaftPlatform::render()
|
||||||
|
{
|
||||||
|
if ( m_isActive )
|
||||||
|
{
|
||||||
|
CPlatformThing::render();
|
||||||
|
|
||||||
|
if (canRender())
|
||||||
|
{
|
||||||
|
DVECTOR &renderPos=getRenderPos();
|
||||||
|
SVECTOR rotation;
|
||||||
|
|
||||||
|
rotation.vx = 0;
|
||||||
|
rotation.vy = 0;
|
||||||
|
rotation.vz = getCollisionAngle();
|
||||||
|
|
||||||
|
VECTOR scale;
|
||||||
|
scale.vx = ONE;
|
||||||
|
scale.vy = ONE;
|
||||||
|
scale.vz = ONE;
|
||||||
|
|
||||||
|
m_modelGfx->Render(renderPos,&rotation,&scale);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -22,6 +22,7 @@ class CNpcRaftPlatform : public CNpcPlatform
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void postInit();
|
virtual void postInit();
|
||||||
|
virtual void render();
|
||||||
protected:
|
protected:
|
||||||
virtual void processMovement( int _frames );
|
virtual void processMovement( int _frames );
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue