「Unity/Csharp/位置」の版間の差分
提供: 初心者エンジニアの簡易メモ
(→方向) |
(→方向) |
||
行25: | 行25: | ||
new Vector3(0, 1, 0) | new Vector3(0, 1, 0) | ||
Vector3.up | Vector3.up | ||
+ | </pre> | ||
+ | |||
+ | <pre> | ||
+ | Vector3(0, -1, 0) | ||
+ | Vector3.down | ||
+ | </pre> | ||
+ | |||
+ | <pre> | ||
+ | Vector3(1, 0, 0) | ||
+ | Vector3.right | ||
+ | </pre> | ||
+ | |||
+ | <pre> | ||
+ | Vector3(-1, 0, 0) | ||
+ | Vector3.left | ||
+ | </pre> | ||
+ | |||
+ | <pre> | ||
+ | Vector3(0, 0, 1) | ||
+ | Vector3.forward | ||
+ | </pre> | ||
+ | |||
+ | <pre> | ||
+ | Vector3(0, 0, -1) | ||
+ | Vector3.back | ||
</pre> | </pre> |
2022年8月20日 (土) 06:47時点における版
中間位置
Vector3 center = Vector3.Lerp(fromObj, toObj, 0.5f);
3dの回転
Unity/3d/回転 [ショートカット]
方向
以下それぞれ2つは同じ意味
new Vector3(0f, 0f, 0f) Vector3.one
new Vector3(1f, 1f, 1f) Vector3.zero
new Vector3(2f, 2f, 2f) Vector3.one * 2;
new Vector3(0, 1, 0) Vector3.up
Vector3(0, -1, 0) Vector3.down
Vector3(1, 0, 0) Vector3.right
Vector3(-1, 0, 0) Vector3.left
Vector3(0, 0, 1) Vector3.forward
Vector3(0, 0, -1) Vector3.back