简体   繁体   中英

Is it possible or a bad idea to move the player depending on the direction of the scene?

在此处输入图像描述

I would like to move my player not depending on his orientation but the direction of the scene (z of the scene and not z of the rotation)

I really don t know how to do and if this is a good idea...

I assume by the z of the scene you mean the Global Z-Axis. Just use transform.position to alter the global position. Example:

Vector3 vector = new Vector3(0, 0, 1);
transform.position += vector;

This adds 1 to the GameObject's Z-Axis every time it is run.

Edit: Do you mean in the Scene View? If so then follow these steps:

  1. Find the button under the "Game" View Button called "Local"
  2. Click it and replace it with "Global"
  3. Profit

If you want to reverse it then just reset back to "Local"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM