Tag Info

Hot answers tagged

4

This is entirely a matter of convention. (Since you didn't mention any particular tools.) But! If you are modeling in the same default orientation as your screen, which you say is right-handed, X-right, Y-up, and therefore Z-towards-you, then it would be natural to model your characters facing you, where forward is Z-positive. Which also implies your ...


3

I was able to get the rotations expected by rotating an accumulated rotation matrix. setIdentityM(currentRotation, 0); rotateM(currentRotation, 0, angleY, 0, 1, 0); rotateM(currentRotation, 0, angleX, 1, 0, 0); // Multiply the current rotation by the accumulated rotation, // and then set the accumulated rotation to the result. multiplyMM(temporaryMatrix, ...


3

The problem your having is called gimble lock. I think what your looking to do is called arcball rotation. The math for arcball can be abit complicated. A simpler way of doing it is finding a 2d vector perpendicular to the 2d swipe on screen. Take the vector and project it onto the camera near plane to get a 3d vector in world space. Screen space to World ...


2

if (Math.abs( angle) > mindelta ) transform.LookAt (currCustom); I think it depends on floating point math errors, I suggest to define a min angle (mindelta in my code example) inside wich, the turret doesn't move


2

So with your provided problem image, the problem is that the top side of the quad is being affected, while the right side is supposed to have the majority of the effect? Is that correct? If that's the case then the problem is that your passing the wrong values to your ZHandler.getz function. Your code, from what I'm seeing, is: glTransform glBegin ... ...


2

You shouldn't use a rotation angles if you can avoid it.* They are a bad representation of directions. If you choose to use them, you will need an inverse trig function. Instead of storing theta, store the pair (cos(theta), sin(theta)). You can combine rotations and directions using the multiplication rules of complex numbers, i.e. (a,b) * (c,d) = (ac - ...


1

I avoid Euler angles in aircraft pitch, roll, yaw orientations because aircraft rotate about thier local axis and trying to resolve this to Euler angles about the world (or global) axis adds uneccesary complication to the code. Instead of 3 Euler angles, I store the current orientation as a matrix or quat and simply modify the matrix/quat depending on input ...


1

You're using vector3.up, vector3.forward and vector3.right to calculate the needed rotations. These axes don't move along with your plane. What you need to do is rotate the plane around its very own up, forward and right vectors. You could do that like this: Matrix rotMat = Matrix.CreateFromQuaternion(model_ROTATION); Quaternion additionalRotation = ...


1

Create a script called TransformExtentions. Paste the code into that script. You can call Transform.RotateTowardsOverTime(Vector3, float) on your Transform where the Vector3 is the target you want to rotate towards and the float is the number of seconds you want it to take. You can call Transform.RotateOverTime(Vector3, float) on your Transform where the ...


1

This is a plain old bug, you're reassigning different values to the same spots, like transform[1][1] = 1+cos(rot.x); ... transform[1][1] = cos(rot.z); What you need to do is combine the rotations in the order you want them applied, like transformX[][]... assigned only from rot.x transformY[][]... assigned only from rot.y transformZ[][]... assigned only ...


1

Your image corresponds with your rotationMatrix code, by rotating the x axis with your previous y rotation you get the local x axis, when you then rotate the object around that you would get the result that you show in your image. To have the rotation be logical from a users point of view you would want to rotate the object using the world coordinate axis ...



Only top voted, non community-wiki answers of a minimum length are eligible