Hey guys.
After adding a new ship to a game I am currently working on, I encountered a problem. When rotating the new ship with the same script das the first ship, it starts to rotate on another axis as well(should only rotate on y when pressing “a” or “d”). There is no other force applied so dont say that . Its the exact same script.
I have uploaded a video on yt so you can see what I mean:
On the first clip the ship rotates perfectly only on the y axis. The second clip… yeah. You can see what I mean.
As you can see the bug only occurs on the y rotation. X and Z rotation work fine still.
Here is the line of code it is rotation with :
It is applied in a fixed update… the turingspeed is a float and horizontal is a float depending on if you pressed horizontal and ranges between 0 and 1.
hmm hard to say without knowing what properties.turningspeed*remote.horizontal does
otherwise i would check my local pivot of the ship if that is setup right…
properties.turningspeed*remote.horizontal is the amount of torque applied to the ship on the y-axis (Vector3(xf,yf,zf)). So it is just a number… And its working for the first ship but not for the second. The pivot is right too… Otherwise the roll and pitch would be funky too…
I found out, that the colliders are the reason but I havent found a solution yet. The fact is that as more excentric the object and this way the position of its colliders gets the more crazy the add realative torque behaves. Does anyone have experiences to fix that?
I have to use AddRelativeTorque for spacheships in a spaceshipgame. Otherwise the rotation is extremly weird…
I added a invisible cube to the ship as some kind of counterweight… Not the most clean way to do it but it works now