Hi,
im trying to create a drone in UE4 C++
i AddTorqueInRadians to my motors, but Torque is added in World transform, so even if my drone is tilted, it still spins on world X axis only, how do i convert below to local Vector?
const FRotator MotorRotation = /* Your Motor's world rotation */;
const FVector YawTorqueWS = FVector(0.f, 0.f, (ThrottleV - YawV) * YawPower)); /* The Yaw Torque we want to apply in World Space */
const FVector YawTorqueLS = FRotationMatrix(MotorRotation).TransformVector(YawTorqueWS); /* Transform World Space Torque by the component's World Rotation to Local */
Motor_LB->AddTorqueInRadians(YawTorqueLS, Motor_LB->GetFName());