How to make the ball spin faster in Rolling sample project (C++)

The following is the code in the constructor of the generated class ARollingTestBall. Wishing to make the ball spin faster, I tried changing the values Ball->BodyInstance.MaxAngularVelocity and RollTorque, but the result (Ball->GetPhysicsAngularVelocity()) never exceeds 800. Can anyone tell me why?

// Create mesh component for the ball
Ball = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Ball0"));
Ball->SetStaticMesh(BallMesh.Object);
Ball->BodyInstance.SetCollisionProfileName(UCollisionProfile::PhysicsActor_ProfileName);
Ball->SetSimulatePhysics(true);
Ball->SetAngularDamping(0);
Ball->SetLinearDamping(0.1f);
Ball->BodyInstance.MassScale = 3.5f;
Ball->BodyInstance.MaxAngularVelocity = 800.0f;
Ball->SetNotifyRigidBodyCollision(true);
RootComponent = Ball;

// Create a camera boom attached to the root (ball)
SpringArm = CreateDefaultSubobject<USpringArmComponent>(TEXT("SpringArm0"));
SpringArm->AttachTo(RootComponent);
SpringArm->bDoCollisionTest = false;
SpringArm->bAbsoluteRotation = true; // Rotation of the ball should not affect rotation of boom
SpringArm->RelativeRotation = FRotator(-45.f, 0.f, 0.f);
SpringArm->TargetArmLength = 1200.f;
SpringArm->bEnableCameraLag = false;
SpringArm->CameraLagSpeed = 3.f;

// Create a camera and attach to boom
Camera = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera0"));
Camera->AttachTo(SpringArm, USpringArmComponent::SocketName);
Camera->bUsePawnControlRotation = false; // We don't want the controller rotating the camera

// Set up forces
RollTorque = 50000000.0f;
JumpImpulse = 350000.0f;
bCanJump = true; // Start being able to jump

Hello,

Please note that you can get the maximum speed like this:

float speed = Ball->GetPhysicsAngularVelocity().GetAbsMax();

To check it’s actual value, you can add debug message to MoveForward function:

GEngine->AddOnScreenDebugMessage(-1, 1, FColor::Red, FString::SanitizeFloat(Ball->GetPhysicsAngularVelocity().GetAbsMax()));

For example, with the following parameters

Ball->BodyInstance.MaxAngularVelocity = 1800.0f;
RollTorque = 500000000.0f;

you can see that the actual velocity changes up to 1800:

44072-max_speed.png

Hope this helped!

Have a great day!

,
Thank you for your quick reply. However, for some strange reason, I did exactly what you said and I still get something like 796. I am attaching a screenshot as well as the file RollingTestBall.cpp (renamed to RollingTestBall.txt). I also tried setting Ball->BodyInstance.MaxAngularVelocity to 400 and I get the same result. Besides changing RollingTestBall.cpp, do I have to do anything with any of the content files?

, I revisited the problem again after upgrading to UE4.8 and I think I know what happened. I cannot just recompile the project within the editor; I MUST restart the editor every time for it to take effect!