Tag Info

Hot answers tagged

35

I think the direction of the coordinate axes are holdovers from different domains where the crucial plane was different, and X/Y were aligned with that crucial plane. In some applications the ground plane was the most important, thus X/Y were the ground and Z ended up perpendicular to that. For games however the crucial plane is usually the screen ...


5

How do you want this to behave? There are different ways to do this. A simple option is to just move the object by some fixed number of world space units for each screen space unit (pixel, say) that the mouse moves. Another option is to take the vector of mouse movement and project it onto the axis of movement through the normal projection/camera ...


4

I would expect your matrix multiplication code to look like | 1 0 0 | [x,y,1] * | 0 1 0 | = [x+50,y,1] | 50 0 1 | This is because matrix multiplication is defined so that you go by row in the first operand and by column in the second operand. Here's the relevant formula from wikipedia, although you should consider reviewing the ...


3

Your formula is correct. I would suggest normalising the quaternion at the end, though, or any stage involving interpolation will likely be messed up. What I believe is happening is that your up vector is (0, something, 0) and your normal vector is (0, -1, 0). In this very specific corner case (when the input vectors are opposite to each other) there is no ...


2

To illustrate, look at this image generated by Wolfram Alpha: You have your 3 local coordinate axes and you want to coincide any of them with a given forth vector (for instance (1/2, 1/2, 1/2) as in the image). To do that, you need to rotate your object. A rotation is best described as a combination of an angle and axis to rotate around. So how do we find ...


2

It's mostly legacy from the times when all that could've been made with 3D was some screen-space rotating cube or parallax scrolling or something similar. In such applications, Z was "depth" because X and Y were the axes for the screen plane. As demos were getting more advanced, the original conventions stayed because it's easier not to change anything that ...


2

Usually this is handled a bit differently. When manipulator is picked, you choose a movement plane (XY, YZ or XZ). Then you cast ray from cursor on to that plane and detect the hit point and move the manipulator (and object) to that location. Special cases you need to work around for are when the plane is parallel to the view and ray from cursor can reach ...


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

I spent a while chasing ways to change my problem to use Euler angles, but the easy solution was actually to just 0 the components of the axis I didn't want, i.e. (in C# Unity script) Vector3 axis = Vector3.Cross(RD, RE); axis.x = CanPitch() ? axis.x : 0.0f; axis.y = CanYaw() ? axis.y : 0.0f; axis.z = CanRoll() ? axis.z : 0.0f; where RD and RE are ...


1

http://docs.unity3d.com/ScriptReference/Vector3.Lerp.html Have a look at lerp. You'll be able to move to a position over time like this: transform.position = Vector3.Lerp( start, end, currentTime / totalTime ); Where start is the initial position of the object you are moving and end is the place you want to be once currentTime = totalTime. In your case, ...


1

I figured out the best way to do this is to check the screen size on the device and base a boolean conditional to device on which axis to use. This is tested and working great. // Check the screen layout to determine if the device is a tablet. public boolean isTablet(Context context) { boolean xlarge = ...


1

As far as I have ever gleaned the Y = up/down, and Z = depth is based off of physics where gravity is always in the (-Y) direction, and then adding 3D means you don't want to change a fundamental, so it was made depth. On the Z = up/down method though that is a throw back to mathematicians. because X/Y was drawn on the paper that was flat on the table when ...


1

Because the coordinate system that are used in games are based off of the dimension of the monitor. When computer renders anything, it starts at the upper left hand corner which gives the x, and y coordinate of [ 0, 0 ]. As the rendering progresses towards the right side of the screen, the x value increments, respectively when the render moves down, the y ...



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