vphysics_bullet/Physics_Object.cpp
void CPhysicsObject::CalculateVelocityOffset(const Vector &forceVector, const Vector &worldPosition, Vector *centerVelocity, AngularImpulse *centerAngularVelocity) const {
	if (!centerVelocity && !centerAngularVelocity) return;

	btVector3 force, relpos;
	ConvertForceImpulseToBull(forceVector, force);
	ConvertPosToBull(worldPosition, relpos);

	relpos -= m_pObject->getCenterOfMassPosition();

	// Relative pos cross normal
	btVector3 cross = relpos.cross(force);

	// Linear velocity
	if (centerVelocity) {
		force *= m_pObject->getInvMass();
		ConvertForceImpulseToHL(force, *centerVelocity);
	}

	if (centerAngularVelocity) {
		// Convert to local space and give it to the game (game rotations in local space)
		cross = m_pObject->getWorldTransform().getBasis().transpose() * cross;
		ConvertAngularImpulseToHL(cross, *centerAngularVelocity);
	}
}
// forceVector is an impulse (F*t AKA m*v) in world space
forceVector is an impulse (F*t AKA m*v) in world space
forceVector is an impulse ( F * t AKA m * v ) in world space
void CPhysicsObject::CalculateVelocityOffset(const Vector &forceVector, const Vector &worldPosition, Vector *centerVelocity, AngularImpulse *centerAngularVelocity) const {
	if (!centerVelocity && !centerAngularVelocity) return;
	btVector3 force, relpos;
	ConvertForceImpulseToBull(forceVector, force);
	ConvertPosToBull(worldPosition, relpos);
	relpos -= m_pObject->getCenterOfMassPosition();
	btVector3 cross = relpos.cross(force);
	if (centerVelocity) {
		force *= m_pObject->getInvMass();
		ConvertForceImpulseToHL(force, *centerVelocity);
	}
	if (centerAngularVelocity) {
		cross = m_pObject->getWorldTransform().getBasis().transpose() * cross;
		ConvertAngularImpulseToHL(cross, *centerAngularVelocity);
	}
}
void CPhysicsObject :: CalculateVelocityOffset ( const Vector & forceVector , const Vector & worldPosition , Vector * centerVelocity , AngularImpulse * centerAngularVelocity ) const { if ( ! centerVelocity && ! centerAngularVelocity ) return ; btVector3 force , relpos ; ConvertForceImpulseToBull ( forceVector , force ) ; ConvertPosToBull ( worldPosition , relpos ) ; relpos -= m_pObject -> getCenterOfMassPosition ( ) ; btVector3 cross = relpos . cross ( force ) ; if ( centerVelocity ) { force *= m_pObject -> getInvMass ( ) ; ConvertForceImpulseToHL ( force , * centerVelocity ) ; } if ( centerAngularVelocity ) { cross = m_pObject -> getWorldTransform ( ) . getBasis ( ) . transpose ( ) * cross ; ConvertAngularImpulseToHL ( cross , * centerAngularVelocity ) ; } }
forceVector is an impulse (F*t AKA m*v) in world space
forceVector is an impulse ( F * t AKA m * v ) in world space
// Relative pos cross normal // Linear velocity // Convert to local space and give it to the game (game rotations in local space)