|
I'm working on a grid-based movement system. I have a regular 1x1x1 cube. Let's say I want it to move forward 1 unit. I'll press the W key, and the cube will set a new position 1 unit forward relative to its initial position. All the movement systems I've seen here are smooth. I want one that "teleports" the object in a certain direction and distance.
(comments are locked)
|
|
An easy way is telling the distance in whatever (x, y or z) you are using and then use this code, Wow, it worked. Thanks! Now is there a way to move it relative to the camera's rotation?
May 08 '11 at 01:06 AM
Irsan
Yes, move it in the direction of Camera.current.transform.forward instead of on the global x-axis.
May 08 '11 at 01:28 AM
Joshua
I noticed that the object isn't taking its own rotation into account. It seems to move relative to the world position instead of its own local position. using "localPosition" doesn't work apparently.
May 08 '11 at 02:37 AM
Irsan
(comments are locked)
|
