normalize controls in left and right views also.
There is a bit strange effect during roll in side views, it seems the centre of roll is not the centre of view, but I can not fix this by moving the viewpoint in shipdata due to the centre moving further with my changes.
Still usable imho and no problem with yaw which is much better in side views to compensate the forward movement of your ship.
Thanks to Lone Wolf for a performance idea which is implemented now also, and here is an answer to his question arrived in pm about the math
, maybe others are interested also.
In my code ps.pitch is the current pitching speed in angle/second what the player set with his controller in this moment. I multiply ps.pitch with delta (the fraction of a second elapsed since the last frame) to get the angle what the ship rotated since the last frame. Then I apply the double of this angle in reverse direction to cancel the rotation added by the core and make a similar opposite one.
When I set pitch then I rotate around prevori.vectorRight
() which points to "right" from the orientation vector of the previous frame.
Imagine the forward vector of your ship, then turn right (press F4
), then rotate yourself clockwise around your centre: this is what your ship do when pitching up. In js:
var a = ps.pitch * delta;
var c = prevori.vectorRight();
ps.orientation = ps.orientation.rotate( c, 2 * a );
Then I do the same with roll also, then the variations of this to the side views. After I imagined the situtation in a side view I applied the current roll to the new pich and pitch to roll, then I tried and corrected the direction by a minus sign before