Tag Info

New answers tagged

0

To get 2d screen coordinates from a 3d world space location, you would use Viewport.Project, not Viewport.Unproject. The world matrix to put in the Project method would be the same one you use to set the effect.World property for rendering.


0

Smaller data helps a lot with performance which becomes critical when you have dozens or hundreds of characters with multiple blended animations. There can also be several advantages to using quaternions when interpolating between frames of an animation. Matrices can theoretically fail to represent certain series of transformations (gimbal lock) and linear ...


2

Everything is an optimization of the 4x4 matrix when it comes to 3D math. A 3x4 is about saving memory because the last column/row for non-projection matrices is [ 0 0 0 1 ]. Pure rotational 3x3 matrices are extremely convenient because you can invert them by just transposing them. For animation and camera systems, quaternions are ideal for lots of reason, ...


0

First, keep in mind that the order in which you apply the transformations is important. This is because matrix multiplication is not transitive: A*B != B*A I'm guessing your intent is to scale the rectangle first, then translate it to the right position. If you do it the other way around the distance translated will be scaled as well, which is probably not ...


2

If the engine is using the 3D graphics hardware under the hood, then it still has vertices, even if it's a 2D game. The models might be very simpleā€”a rectangle for each sprite, for instance. But the matrices would still apply to the vertices, just as they do in a 3D game. If the engine doesn't use 3D graphics hardware under the hood, but does all its own ...


0

Found the problem. XNA's content pipeline doesn't seem to be able to handle animated FBXs correctly. So XNA has a bug. Luckily Blender 2.68a and older has a "fix" for this. Just check "XNA rotation animation hack" when exporting the FBX.


0

By mapping out the transformation on graph paper, traversing the steps in reverse from result to original point, I was able to figure out the exact steps needed to answer my question. Instead of just building on my matrices with functions, I created several different matrices, each with their own part of the transform (rotation, translation). I then ...


-1

Depending on your compiler, when you divide PI in your calculations then the result could be interpreted as either a float or an int. From what I recall, the C++ standard demands that the result of an arithmetic operation on basic data types will always have the same signature as the left hand operand. However, not all compilers follow the standard. Because ...


0

I think I solved it. The answer is: var matrix = new Matrix(); var cos = Math.cos(angle); var sin = Math.sin(angle); matrix.a = scaleX * cos * screenScaleX; matrix.b = scaleX * sin * screenScaleY; matrix.c = -scaleY * sin * screenScaleX; matrix.d = scaleY * cos * screenScaleY; This way, the screen can use non-uniform scaling without distorting rotated ...


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