This commit is contained in:
Charles 2001-05-09 23:14:35 +00:00
parent 7c224ca827
commit 57de623103
10 changed files with 107 additions and 11 deletions

View file

@ -36,7 +36,17 @@
void CNpcBranchPlatform::postInit()
{
CNpcPlatform::postInit();
sBBox boundingBox = m_modelGfx->GetBBox();
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ) << 1, 50 + ( boundingBox.YMax - boundingBox.YMin ) );
if ( m_reversed )
{
setCollisionCentreOffset( boundingBox.XMax, 18 + ( ( boundingBox.YMax + boundingBox.YMin ) >> 1 ) );
}
else
{
setCollisionCentreOffset( boundingBox.XMin, 18 + ( ( boundingBox.YMax + boundingBox.YMin ) >> 1 ) );
}
m_angularVelocity = 0;
}
@ -300,3 +310,27 @@ void CNpcBranchPlatform::render()
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcBranchPlatform::calculateBoundingBoxSize()
{
int angle;
DVECTOR centre;
int length;
int x1,y1,x2,y2;
angle=getCollisionAngle();
centre=getCollisionCentre();
//halfLength=m_platformWidth/2;
sBBox boundingBox = m_modelGfx->GetBBox();
length = ( boundingBox.XMax - boundingBox.XMin );
x1=-length*mcos(angle&4095)>>12;
y1=-length*msin(angle&4095)>>12;
x2=+length*mcos(angle&4095)>>12;
y2=+length*msin(angle&4095)>>12;
setCollisionSize(abs(x2-x1),50 + abs(y2-y1)+PLATFORMCOLLISIONHEIGHT);
}