/* ================ idPhysics_Parametric::SetMaster ================ */ void idPhysics_Parametric::SetMaster( idEntity *master, const bool orientated ) { idVec3 masterOrigin; idMat3 masterAxis; if ( master ) { if ( !hasMaster ) { // transform from world space to master space self->GetMasterPosition( masterOrigin, masterAxis ); current.localOrigin = ( current.origin - masterOrigin ) * masterAxis.Transpose(); if ( orientated ) { current.localAngles = ( current.axis * masterAxis.Transpose() ).ToAngles(); } else { current.localAngles = current.axis.ToAngles(); } current.linearExtrapolation.SetStartValue( current.localOrigin ); current.angularExtrapolation.SetStartValue( current.localAngles ); hasMaster = true; isOrientated = orientated; } } else { if ( hasMaster ) { // transform from master space to world space current.localOrigin = current.origin; current.localAngles = current.angles; SetLinearExtrapolation( EXTRAPOLATION_NONE, 0, 0, current.origin, vec3_origin, vec3_origin ); SetAngularExtrapolation( EXTRAPOLATION_NONE, 0, 0, current.angles, ang_zero, ang_zero ); hasMaster = false; } } }
/* ================ sdPhysics_Linear::SetMaster ================ */ void sdPhysics_Linear::SetMaster( idEntity *master, const bool orientated ) { if ( master ) { if ( !hasMaster ) { idVec3 masterOrigin; idMat3 masterAxis; // transform from world space to master space self->GetMasterPosition( masterOrigin, masterAxis ); current.localOrigin = ( current.origin - masterOrigin ) * masterAxis.Transpose(); current.linearExtrapolation.SetStartValue( current.localOrigin ); hasMaster = true; isOrientated = orientated; } } else { if ( hasMaster ) { // transform from master space to world space current.localOrigin = current.origin; SetLinearExtrapolation( EXTRAPOLATION_NONE, 0, 0, current.origin, vec3_origin, vec3_origin ); hasMaster = false; } } }
/* ================ idPhysics_Parametric::SetLinearVelocity ================ */ void idPhysics_Parametric::SetLinearVelocity( const idVec3 &newLinearVelocity, int id ) { SetLinearExtrapolation( extrapolation_t(EXTRAPOLATION_LINEAR|EXTRAPOLATION_NOSTOP), gameLocal.time, 0, current.origin, newLinearVelocity, vec3_origin ); current.linearInterpolation.Init( 0, 0, 0, 0, vec3_zero, vec3_zero ); Activate(); }
/* ================ sdPhysics_Linear::SetLinearVelocity ================ */ void sdPhysics_Linear::SetLinearVelocity( const idVec3& newLinearVelocity, int id ) { SetLinearExtrapolation( extrapolation_t( EXTRAPOLATION_LINEAR | EXTRAPOLATION_NOSTOP ), gameLocal.time, 0, current.origin, newLinearVelocity, vec3_origin ); Activate(); }