This commit is contained in:
Charles 2001-06-08 16:08:18 +00:00
parent 6874230557
commit 2c8c4fcb60
2 changed files with 47 additions and 1 deletions

View file

@ -139,4 +139,49 @@ void CNpcRaftPlatform::processMovement( int _frames )
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);
}
}
}

View file

@ -22,6 +22,7 @@ class CNpcRaftPlatform : public CNpcPlatform
{
public:
virtual void postInit();
virtual void render();
protected:
virtual void processMovement( int _frames );