Browse Source

vphysics: fix velocity restore

dedicated-build-fix
nillerusr 2 years ago
parent
commit
ba8fd2952f
  1. 20
      vphysics/physics_object.cpp

20
vphysics/physics_object.cpp

@ -1042,7 +1042,7 @@ void CPhysicsObject::SetVelocityInstantaneous( const Vector *velocity, const Ang @@ -1042,7 +1042,7 @@ void CPhysicsObject::SetVelocityInstantaneous( const Vector *velocity, const Ang
return;
IVP_Core *core = m_pObject->get_core();
Wake();
WakeNow();
if ( velocity )
{
@ -1859,27 +1859,29 @@ void CPhysicsObject::InitFromTemplate( CPhysicsEnvironment *pEnvironment, void * @@ -1859,27 +1859,29 @@ void CPhysicsObject::InitFromTemplate( CPhysicsEnvironment *pEnvironment, void *
EnableCollisions( true );
}
// will wake up the object
m_asleepSinceCreation = objectTemplate.asleepSinceCreation;
if ( objectTemplate.velocity.LengthSqr() != 0 || objectTemplate.angVelocity.LengthSqr() != 0 )
{
// will wake up the object
SetVelocityInstantaneous( &objectTemplate.velocity, &objectTemplate.angVelocity );
if ( objectTemplate.isAsleep )
{
Sleep();
}
else if( !objectTemplate.isAsleep )
{
Assert( !objectTemplate.isStatic );
WakeNow();
}
m_asleepSinceCreation = objectTemplate.asleepSinceCreation;
if ( !objectTemplate.isAsleep )
if( objectTemplate.isAsleep )
{
Assert( !objectTemplate.isStatic );
Wake();
Sleep();
}
if ( objectTemplate.hingeAxis )
{
BecomeHinged( objectTemplate.hingeAxis-1 );
}
if ( objectTemplate.hasTouchedDynamic )
{
SetTouchedDynamic();

Loading…
Cancel
Save