• News
• About

• Industries

• Learning & Support

• Community

• Marketplace

Download # Pawn is rotating too fast (No Angular damping)

``````
void AHoverPawn::TurnActor(float AxisValue)
{

FVector Cv = Car->GetPhysicsLinearVelocity();
FVector Fv = Car->GetForwardVector();
float f = FVector::DotProduct(Cv, Fv);
if (f > 0)
{

Car->AddTorque(FVector(0, 0, 1000000 * AxisValue));
FVector Rv = Car->GetRightVector();
FVector V = Car->GetComponentVelocity();
float dotP = FVector::DotProduct(Rv, V);

float invertValue = dotP * -1;
float next = invertValue * 4000;
FVector getRv = Car->GetRightVector();

Car->AddForce(getRv * next);

Car->AddForce(getRv * next);
}
else
{

Car->AddTorque(FVector(0, 0, 900000 * AxisValue *-1));
FVector Rv = Car->GetRightVector();
FVector V = Car->GetComponentVelocity();
float dotP = FVector::DotProduct(Rv, V);

float invertValue = dotP * -1;
float next = invertValue * 4000;
FVector getRv = Car->GetRightVector();

Car->AddForce(getRv * next);

}
}

``````

this rotates my pawn, but the problem is it rotates really fast because of the input, and then goes out of control. I got the Pawns angular velocity and used the FVector::Size() method which returns a float, The angular rotation velocity was going up when ever I held down D. In order to bring it down to 0, I would have to hold down A as it spins out of control.

How can I stop the Pawn from rotating out of control?

It is a

``````
Car = CreateDefaultSubobject<UBoxComponent>(TEXT("CarMesh"));

``````

Physics box component with physics enabled.

The pawn is hard to control, since it rotates too fast.

Bump, pelase hellp

You are adding torque to a car where you just multiply AxisValue by constant. You constant is responsible for amplitude of torque. Make it smaller.

I need a lot of force to move it though