mirror of
https://github.com/m-lamonaca/dev-notes.git
synced 2025-05-15 15:44:47 +00:00
Fix typos
This commit is contained in:
parent
76550dfa3c
commit
5c0799df7f
118 changed files with 1150 additions and 1602 deletions
|
@ -1,4 +1,4 @@
|
|||
# Vector, Tranfrorm, Space
|
||||
# Vector, Transform, Space
|
||||
|
||||
## Vector2, Vector3, Vector4
|
||||
|
||||
|
@ -33,8 +33,8 @@ Vector3.one // Vector3(1, 1, 1)
|
|||
### Operations
|
||||
|
||||
```cs
|
||||
Vector3(x, y, z) * n = Vecotr3(xn, yn, yz);
|
||||
Vector3(x, y, z) / n = Vecotr3(x / n, y / n, y / z);
|
||||
Vector3(x, y, z) * n = Vector3(xn, yn, yz);
|
||||
Vector3(x, y, z) / n = Vector3(x / n, y / n, y / z);
|
||||
|
||||
Vector3(x1, y1, z1) + Vector3(x2, y2, z2) = Vector3(x1 + x2, y1 + y2, z1 + z2);
|
||||
Vector3(x1, y1, z1) - Vector3(x2, y2, z2) = Vector3(x1 - x2, y1 - y2, z1 - z2);
|
||||
|
@ -54,11 +54,11 @@ MovementInFrame = Speed * timeSinceLastFrame
|
|||
[Transform Docs](https://docs.unity3d.com/ScriptReference/Transform.html)
|
||||
|
||||
```cs
|
||||
// propetries
|
||||
transfrom.position // Vector3 - global position
|
||||
transfrom.localPosition // Vector3 - local position
|
||||
// properties
|
||||
transform.position // Vector3 - global position
|
||||
transform.localPosition // Vector3 - local position
|
||||
transform.rotation // Quaternion - global rotation
|
||||
transfrom.parent // Transform - parent of the object
|
||||
transform.parent // Transform - parent of the object
|
||||
|
||||
transform.localScale = Vector3; // set object dimensions
|
||||
|
||||
|
@ -67,21 +67,21 @@ transform.Rotate(Vector3 * Time.deltaTime * speed, Space); // set rotation usin
|
|||
transform.Translate(Vector3 * Time.deltaTime * speed, Space); // set movement in selected space
|
||||
```
|
||||
|
||||
### Local, GLobal & Object Spcace
|
||||
### Local, GLobal & Object Space
|
||||
|
||||
**Local Space**: Applies transformation relative to the *local* coordinate system (`Space.Self`).
|
||||
**Global Space**: Applies transformation relative to the *world* coordinate system (`Space.World`)
|
||||
|
||||
### Parenting
|
||||
|
||||
Changing the parent will make position, scale and rotation of the child object retalive to the parent but keep the world space's position, rotation and scale the same.
|
||||
Changing the parent will make position, scale and rotation of the child object relative to the parent but keep the world space's position, rotation and scale the same.
|
||||
|
||||
Setting the parentele by script:
|
||||
|
||||
```cs
|
||||
public class ParentScript : MonoBehaviour {
|
||||
public Transform childTransform; // reference to the child object transfrom
|
||||
public Transform childTransform; // reference to the child object transform
|
||||
|
||||
childTrandform.parent = transfrom; // when evaluated at runtime sets current object as parent of another
|
||||
childTransform.parent = transform; // when evaluated at runtime sets current object as parent of another
|
||||
}
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue