New answers tagged


Well, I generally use to ask this questions in interviews :) Although I don't know Swift but I can give you a general idea about to achieve this. You have to play with some trigonometry to get current direction vector according to your current angle. Here is the pseudo code. float speed = 0.01 void GameLoop() { // I don't know that how Vector2 works ...


You will need a forward vector which represent the forward direction of your ship, and the velocity of your ship. // Stuff that you need (or already have) vec3 shipForwardVector; // This is according to your game infrastructure // and ship model; make it a unit vector. mat4 worldSpaceRotationMat; // assuming ship!.transform is only ...


I realized why this happens. When the quaternion is made, the axis is multiplied by sinus of the half angle. When the rotation gets to 360 that value will be zero so the axis information will be lost.


Well given 360-degree angles. Then a 360-degree rotation makes a full turn and as such is equivalent to 0-degrees or simply no rotation.


In the case of a puzzle like this you can animate the rotation then reset the model back to its original position but with the cube's stickers rotated. Look at it like cheating with a real puzzle by moving the stickers. You'll have to make it possible to change the stickers' colors. This can be done with material colors or a dynamic texture. And this way ...


There is simpler solution. That jittering happens because GUI is updated more frequently than the Update or LateUpdate. Just move the code related to raycasting from moving camera through cursor position into the OnGUI() function instead of Update() or LateUpdate(). Everything runs smoothly. Just remember that it may be called more than one time per frame so ...


I finally found a very clear derivation, here: It's by Fabian Giesen (ryg) of demo-scene fame.


If your goal is to have quaternion that expresses rotations, and if you want to do operations with them (for eg. rotation composition by multiplying quaternions or convertion a quaternion to a rotation matrix), they must be unit quaternions, otherwise you may have unexpected results. Quaternion normalization is a relatively costly operation involving ...

Top 50 recent answers are included