1
0

Minor Entity.cpp cleanup

This commit is contained in:
Tiger Wang 2014-03-19 23:07:16 +00:00
parent 0524d70774
commit a0720a65d6

View File

@ -733,13 +733,11 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
if( NextSpeed.SqrLength() > 0.f )
{
cTracer Tracer( GetWorld() );
int Ret = Tracer.Trace( NextPos, NextSpeed, 2 );
if( Ret ) // Oh noez! we hit something
bool HasHit = Tracer.Trace( NextPos, NextSpeed, 2 );
if (HasHit) // Oh noez! we hit something
{
// Set to hit position
if ((Tracer.RealHit - NextPos).SqrLength() <= (NextSpeed * a_Dt).SqrLength())
{
if( Ret == 1 )
{
if (Tracer.HitNormal.x != 0.f) NextSpeed.x = 0.f;
if (Tracer.HitNormal.y != 0.f) NextSpeed.y = 0.f;
@ -749,7 +747,6 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
{
m_bOnGround = true;
}
}
NextPos.Set(Tracer.RealHit.x,Tracer.RealHit.y,Tracer.RealHit.z);
NextPos.x += Tracer.HitNormal.x * 0.3f;
NextPos.y += Tracer.HitNormal.y * 0.05f; // Any larger produces entity vibration-upon-the-spot