Download

Does anyone know the formula for angular velocity?

I’ve been using trial and error for months and haven’t been able to figure how to get angular velocity in the format UE4 wants for the Set Physics Angular Velocity function.

This questions seems to come up on the forums, but nobody seems to post the answer.


FQuat Orientation = GetComponentQuat();
	FQuat DeltaQ = OldOrientation.Inverse() * Orientation;
	FVector Axis;
	float Angle;
	DeltaQ.ToAxisAndAngle(Axis, Angle);
	Angle = FMath::RadiansToDegrees(Angle);
	AngularVelocity = Orientation.RotateVector((Axis * Angle) / DeltaTime);
	OldOrientation = Orientation;