# Tag Info

37

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 matrices....

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

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 ...

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

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

First, it won't solve your problem, but there are a few general problems with your code. The conditions for your if branch will always be true if transform.localEulerAngles.x >= 0 and <= 360. The > 270 part is redundant since if x is less than 270, it is still possible to be >= 0. If x is 0 and lookAxisX is > 0, then adding -lookAxisX will make x < 0,...

1

One of the two parents is rotated 90 degrees around the Y axis. I can't be sure which way, but you can "fix" this by toggling Global/Local gizmos (its one of the two buttons in the upper-left corner, just above the "scene" tab). That, or un-rotating the parent object.

1

Gravity is additive. Calculate the gravity generated by planet A at point x. Then multiply by a unit vector pointing from x to A - that returns a vector, which gives the gravity a direction. Repeat for planet B, C, etc, then add the vectors. Velocity is acceleration times time. Every frame, multiply the acceleration vector by the delta time, and add the ...

1

I had your same problem. In my case It got fixed by closing unity and reconnecting the PS3 controller before starting Unity again. Maybe it helps

1

The PS3 controller is not directly compatible with PC. You will need a driver and a program to translate the controls to the format used on a PC. If you search the net, most articles will refer to an app called MotionInJoy but I've read many reports online that it is adware (maybe worse) and it's advised to avoid it. I've not used it but better safe than ...

1

You can always try to use the clamp method: Ref: http://docs.unity3d.com/ScriptReference/Mathf.Clamp.html Example transform.localEulerAngles = new Vector3(Mathf.Clamp(transform.localEulerAngles.x, 0f, 90f), 0, 0); **This is just a push in the right direction (above is untested)

1

You need to do this as a hierarchy. Have a main Object that you move and run all your code on, and then add the sprite as a child object and rotate the sprite object only so it aligns the way you want it to.

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 Vector3'...

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 = ((context.getResources().getConfiguration()....

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