Renamed Get the geometrical position of an object to /Script/How do I get/set the geometrical position of an object=
commited
commit
523cf852e0496d7ec9db1af80760584ff3eb858a
... | ... | @@ -192,3 +192,5 @@ Recoil Plus+.md: Games/Recoil Plus%2B.md |
192 | 192 | Games/Recoil Plus%2B.md: Games/RemakeGames/Recoil Plus.md |
193 | 193 | Games/RemakeGames/Recoil Plus.md: Games/RemakeGames/Recoil Remake.md |
194 | 194 | Games/Build/How to create Drive Mad games.md: Build/How to create Drive Mad games.md |
195 | Build/Get the geometrical position of an object.md: Script/How do I get/set the geometrical |
|
196 | position of an object=.md |
... | ... | @@ -1,11 +0,0 @@ |
1 | Normally, when you get/set the position of an object, you actually get/set the position of the object's *center of mass*. In many cases this is enough, but when the object's center of mass *isn't exactly its geometrical position*, and you want to locate it (or locate something in it) geometrically, just "getting its position" won't cut it. |
|
2 | ||
3 | [[/uploads/center of mass opaque.png]] |
|
4 | ||
5 | The trick to solve this is to take the vector reported by [[Get Position]] and **offset it by half the total size of of the object**. With total size, I refer to the minimum and maximum vectors of the object, added together. |
|
6 | ||
7 | [[/uploads/geometrical position opaque.png]] |
|
8 | ||
9 | Almost similarly, to set the geometrical position of the object, you set the position of the object to where you want to place it offset by half the total size, **negated**. Or, equally, subtract the offset from the geometrical position. |
|
10 | ||
11 | [[/uploads/set geometrical position opaque.png]] |
|
... | ... | \ No newline at end of file |
... | ... | @@ -0,0 +1,11 @@ |
1 | Normally, when you get/set the position of an object, you actually get/set the position of the object's *center of mass*. In many cases this is enough, but when the object's center of mass *isn't exactly its geometrical position*, and you want to locate it (or locate something in it) geometrically, just "getting its position" won't cut it. |
|
2 | ||
3 | [[/uploads/center of mass opaque.png]] |
|
4 | ||
5 | The trick to solve this is to take the vector reported by [[Get Position]] and **offset it by half the total size of of the object**. With total size, I refer to the minimum and maximum vectors of the object, added together. |
|
6 | ||
7 | [[/uploads/geometrical position opaque.png]] |
|
8 | ||
9 | Almost similarly, to set the geometrical position of the object, you set the position of the object to where you want to place it offset by half the total size, **negated**. Or, equally, subtract the offset from the geometrical position. |
|
10 | ||
11 | [[/uploads/set geometrical position opaque.png]] |
|
... | ... | \ No newline at end of file |