Updated Rotate.md (markdown)
commited
commit
6f2deab15eb8a043053aad0686c916272b0e5c64
... | ... | @@ -1,3 +1,17 @@ |
1 | 1 | Rotates vector by a rotation. |
2 | 2 | |
3 | [[/uploads/Rotate_Vector.png]] |
|
... | ... | \ No newline at end of file |
0 | [[/uploads/Rotate_Vector.png]] |
|
1 | ||
2 | ## Example |
|
3 | ||
4 | You can move a block to the direction that it's facing. |
|
5 | ||
6 | Since the arrow is facing up by default, the velocity of the arrow should be upwards (0, 0, 0.1). To get the velocity of the block if it's not facing up, we can rotate the velocity (0, 0, 0.1) by the block's rotation. To move the block, we just add the block's position and the velocity and set that to the block's new position. |
|
7 | ||
8 | [[/uploads/Screenshot_20210206-121736_Fancade.jpg]] |
|
9 | ||
10 | With the Rotate block, we can also rotate a block around a pivot, instead of just the center of block itself. |
|
11 | ||
12 | To rotate the block around a pivot, we would rotate the vector from the pivot to the block's starting position (not the current position). Make sure you add the result with the pivot before setting it to the block's new position, otherwise it would end up rotating around (0, 0, 0). Setting the pivot's rotation to the block's rotation is to make it rotate around the pivot instead of circling around it without changing rotation. |
|
13 | ||
14 | [[/uploads/Screenshot_20210113-094731_Fancade.jpg]] |
|
... | ... | \ No newline at end of file |