Tag Info

New answers tagged

1

Short answer: by smart compositing rotation and translation. In the image below you can see the process (radius r is distance of your planet from star). If you rotate the moon by rot_m degrees(updated in main loop), it will circle the origin point. If you first rotate and then translate by radius r it will circle in right distance but wont follow your ...


0

They come from two different conventions for aligning the world axes. These conventions are known as Z-up and Y-up. Z-up In mathematics, engineering and most every field but computer graphics, the convention is for the X axis and Y axis to represent the ground plane and the Z axis to point up. Y-up When computer graphics was in its infancy, the X axis ...


4

All 3D rotation must occur about some axis. That's what 3D rotation is. However, not all such rotation occurs about the Z axis. Rotation can be about any axis: X, Y, Z or an arbitrary axis not aligned with any of the principle axes of the coordinate system. What it sounds like you're referring to is the convention of rotating 2D shapes in a 2D plane about ...


1

I don't know if this is a typo in your question or the actual mistake: x = normalize(Oa); v = normalize(Ob); z = a.crossProduct(b); y = x.crossProduct(z); For one you don't seem to be using v at all, but your z looks wrong to me. Did you mean the following? z = normalize(Oa.crossProduct(Ob)); Note the Oa and Ob instead of a and b. The difference is the ...


0

Since your game is 2D, I will assume, as I read in your comments, that there is no "camera". I will assume that you have a view rotation around the player called viewRot. Your player is the center of rotation as well as the center of the bullet. We will first rotate the bullet around itself because it seems logic to me to apply self transformations before ...


1

You could do something as simple as XMVector3TransformNormal of the direction light with the original Rotation. Generally in SIMD-friendly coding, individual component access is a performance hit, so you want to avoid doing it whenever possible. That's why in DirectXMath (aka XNAMath version 3) the individual element members _11 - _44 were removed from ...


0

Ok, think I got it. I now build the rotation matrix directly from the vectors: xAxis = cross(normal, (p1 - p0)) yAxis = cross(normal, xAxis) zAxis = normal rotationMatrix = [ xAxis.x, yAxis.x, zAxis.x, xAxis.y, yAxis.y, zAxis.y, xAxis.z, yAxis.z, zAxis.z ]



Top 50 recent answers are included