src/body/RigidBody.cpp
void RigidBody::setLinearVelocity(const Vector3& linearVelocity) {

    // If it is a static body, we do nothing
    if (mWorld.mRigidBodyComponents.getBodyType(mEntity) == BodyType::STATIC) return;

    // Update the linear velocity of the current body state
    mWorld.mRigidBodyComponents.setLinearVelocity(mEntity, linearVelocity);

    // If the linear velocity is not zero, awake the body
    if (linearVelocity.lengthSquare() > decimal(0.0)) {
        setIsSleeping(false);
    }

    RP3D_LOG(mWorld.mConfig.worldName, Logger::Level::Information, Logger::Category::Body,
             "Body " + std::to_string(mEntity.id) + ": Set linearVelocity=" + linearVelocity.to_string(),  __FILE__, __LINE__);
}
// Set the linear velocity of the rigid body.
/**
 * @param linearVelocity Linear velocity vector of the body
 */
Set the linear velocity of the rigid body.
@param linearVelocity Linear velocity vector of the body
Set the linear velocity of the rigid body . @param linearVelocity Linear velocity vector of the body
void RigidBody::setLinearVelocity(const Vector3& linearVelocity) {
    if (mWorld.mRigidBodyComponents.getBodyType(mEntity) == BodyType::STATIC) return;
    mWorld.mRigidBodyComponents.setLinearVelocity(mEntity, linearVelocity);
    if (linearVelocity.lengthSquare() > decimal(0.0)) {
        setIsSleeping(false);
    }
    RP3D_LOG(mWorld.mConfig.worldName, Logger::Level::Information, Logger::Category::Body,
             "Body " + std::to_string(mEntity.id) + ": Set linearVelocity=" + linearVelocity.to_string(),  __FILE__, __LINE__);
}
void RigidBody :: setLinearVelocity ( const Vector3 & linearVelocity ) { if ( mWorld . mRigidBodyComponents . getBodyType ( mEntity ) == BodyType :: STATIC ) return ; mWorld . mRigidBodyComponents . setLinearVelocity ( mEntity , linearVelocity ) ; if ( linearVelocity . lengthSquare ( ) > decimal ( 0.0 ) ) { setIsSleeping ( false ) ; } RP3D_LOG ( mWorld . mConfig . worldName , Logger :: Level :: Information , Logger :: Category :: Body , " " + std :: to_string ( mEntity . id ) + " " + linearVelocity . to_string ( ) , __FILE__ , __LINE__ ) ; }
Set the linear velocity of the rigid body.
Set the linear velocity of the rigid body .
// If it is a static body, we do nothing // Update the linear velocity of the current body state // If the linear velocity is not zero, awake the body