I have a helicopter with a rigidbody that I hover with upward force and steer and pitch with torque. However, the problem I get is that once you have turned, if you adjust the pitch it becomes a roll. I prefer torque forces here because it gives nice realistic motion. But is there any way I can make the Torque’s vector direction local to itself? Or do I need more nodes or something?
It’s weird because ApplyForce works fine if I multiply the rotation of the body by my up vector, resulting in it “lifting” wherever its top is. This allows you to lean forward to travel forward, like a real helicopter. Is there an Urho function for what I need to do?
Archive 17/01/2023.
Is there a way to do local Torque force?
evolgames
Modanung
Could you show the code where you apply the torque and forces?
evolgames
Yeah sure, it’s simply:
self.hullBody:ApplyTorque(Vector3(self.curAccel, 0, 0) * self.tiltForce)
self.hullBody:ApplyTorque(Vector3(0, self.steering, 0) * self.turnForce)
Modanung
Try using something like:
self:GetNode():GetRight() * self.curAccel * self.tiltForce
self:GetNode():GetUp() * self.steering * self.turnForce
…as arguments.
evolgames
Hm no, that looks like it does the same thing
Modanung
Exactly the same?
Is self:GetNode()
the same as self.hullBody:GetNode()
?
evolgames
Yeah the hullbody rigidbody is a component of self.node. Switching to self.hullBody:GetNode() produces the same result
Modanung
Got repo?
evolgames
Oh no it’s all local in my project folder