Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void ASpaceGamePawn::RollInput(float Val)
- {
- /*TODO:
- Limit maximum angular velocity
- Determine torque values as a function of mass and thrust/agility/whatever value
- Counteract torque by the same value depending on the ship's angular velocity.
- Figure out how to properly manage the rotation of the torque vector, as it is not local torque.
- */
- bool bHasInput = !FMath::IsNearlyEqual(Val, 0.f);
- float targetTorque = 10000;
- if (bHasInput) {
- if (PlaneMesh->GetPhysicsAngularVelocity().X < Agility) {
- FVector torque = FVector(targetTorque * (-Val), 0.f, 0.f);
- PlaneMesh->AddTorque(torque);
- }
- }
- else {
- float sign = - FMath::Sign(PlaneMesh->GetPhysicsAngularVelocity().X);
- PlaneMesh->AddTorque(FVector(targetTorque * sign, 0.f, 0.f));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement