vphysics: fix velocity restore
This commit is contained in:
parent
661415174e
commit
ba8fd2952f
@ -1042,7 +1042,7 @@ void CPhysicsObject::SetVelocityInstantaneous( const Vector *velocity, const Ang
|
|||||||
return;
|
return;
|
||||||
IVP_Core *core = m_pObject->get_core();
|
IVP_Core *core = m_pObject->get_core();
|
||||||
|
|
||||||
Wake();
|
WakeNow();
|
||||||
|
|
||||||
if ( velocity )
|
if ( velocity )
|
||||||
{
|
{
|
||||||
@ -1859,27 +1859,29 @@ void CPhysicsObject::InitFromTemplate( CPhysicsEnvironment *pEnvironment, void *
|
|||||||
EnableCollisions( true );
|
EnableCollisions( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
// will wake up the object
|
m_asleepSinceCreation = objectTemplate.asleepSinceCreation;
|
||||||
|
|
||||||
if ( objectTemplate.velocity.LengthSqr() != 0 || objectTemplate.angVelocity.LengthSqr() != 0 )
|
if ( objectTemplate.velocity.LengthSqr() != 0 || objectTemplate.angVelocity.LengthSqr() != 0 )
|
||||||
{
|
{
|
||||||
|
// will wake up the object
|
||||||
SetVelocityInstantaneous( &objectTemplate.velocity, &objectTemplate.angVelocity );
|
SetVelocityInstantaneous( &objectTemplate.velocity, &objectTemplate.angVelocity );
|
||||||
if ( objectTemplate.isAsleep )
|
|
||||||
{
|
|
||||||
Sleep();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else if( !objectTemplate.isAsleep )
|
||||||
m_asleepSinceCreation = objectTemplate.asleepSinceCreation;
|
|
||||||
if ( !objectTemplate.isAsleep )
|
|
||||||
{
|
{
|
||||||
Assert( !objectTemplate.isStatic );
|
Assert( !objectTemplate.isStatic );
|
||||||
Wake();
|
WakeNow();
|
||||||
|
}
|
||||||
|
|
||||||
|
if( objectTemplate.isAsleep )
|
||||||
|
{
|
||||||
|
Sleep();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( objectTemplate.hingeAxis )
|
if ( objectTemplate.hingeAxis )
|
||||||
{
|
{
|
||||||
BecomeHinged( objectTemplate.hingeAxis-1 );
|
BecomeHinged( objectTemplate.hingeAxis-1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( objectTemplate.hasTouchedDynamic )
|
if ( objectTemplate.hasTouchedDynamic )
|
||||||
{
|
{
|
||||||
SetTouchedDynamic();
|
SetTouchedDynamic();
|
||||||
|
Loading…
Reference in New Issue
Block a user