Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
Close Submission failedFor some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
Close Your name Your email Suggestion* Switch to Manual DescriptionReturns a normalized vector representing the blue axis of the transform in world space.
The example below shows how to manipulate a GameObjectâs position on the Z axis (blue axis) of the transform in world space. Unlike Vector3.forward, Transform.forward moves the GameObject while also considering its rotation.
When a GameObject is rotated, the blue arrow representing the Z axis of the GameObject also changes direction. Transform.forward moves the GameObject in the blue arrowâs axis (Z).
For moving the GameObject on the Z axis while ignoring rotation, see Vector3.forward.
Another example:
using UnityEngine;// Computes the angle between the target transform and this object
public class Example : MonoBehaviour { public float angleBetween = 0.0f; public Transform target;
void Update() { Vector3 targetDir = target.position - transform.position; angleBetween = Vector3.Angle(transform.forward, targetDir); } }
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4