Advertisement
Guest User

FUCKING CLUELESS AM I

a guest
Jul 22nd, 2016
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. void ASpaceGamePawn::RollInput(float Val)
  2. {
  3.  
  4.     /*TODO:
  5.     Limit maximum angular velocity
  6.     Determine torque values as a function of mass and thrust/agility/whatever value
  7.     Counteract torque by the same value depending on the ship's angular velocity.
  8.     Figure out how to properly manage the rotation of the torque vector, as it is not local torque.
  9.     */
  10.     bool bHasInput = !FMath::IsNearlyEqual(Val, 0.f);
  11.     float targetTorque = 10000;
  12.     if (bHasInput) {
  13.         if (PlaneMesh->GetPhysicsAngularVelocity().X < Agility) {
  14.             FVector torque = FVector(targetTorque * (-Val), 0.f, 0.f);
  15.             PlaneMesh->AddTorque(torque);
  16.         }
  17.     }
  18.     else {
  19.         float sign = - FMath::Sign(PlaneMesh->GetPhysicsAngularVelocity().X);
  20.         PlaneMesh->AddTorque(FVector(targetTorque * sign, 0.f, 0.f));
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement