This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
cw4:tutorials:rotation_conversion [2021/01/09 22:29] – Karsten75 | cw4:tutorials:rotation_conversion [2025/02/14 14:57] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | < | + | < |
+ | <=[[cw4:Tutorials]] | ||
====== Converting between different kinds of rotation ====== | ====== Converting between different kinds of rotation ====== | ||
Line 31: | Line 32: | ||
===== The difference between Unity rotation and mathematical rotation ===== | ===== The difference between Unity rotation and mathematical rotation ===== | ||
- | **TLDR; | + | **TLDR; |
- | Even though units are normally locked to the grid, the game allows us to rotate them by any amount. Lets try to give a unit a Y rotation of 30°, which should make them point slightly up and to the right just like the image of the section above. | + | Even though units are normally locked to the grid, the game allows us to rotate them by any amount. Lets try to give a unit a Y rotation of 30°, which should make them point slightly up and to the right, just like the image of the section above. |
<code 4rpl> | <code 4rpl> | ||
Line 46: | Line 47: | ||
It turns out the the same is true for the X-axis (rotating by a negative value will make units face upwards instead of downwards). The Z axis on the other hand is not inverted and works as we would expect. | It turns out the the same is true for the X-axis (rotating by a negative value will make units face upwards instead of downwards). The Z axis on the other hand is not inverted and works as we would expect. | ||
- | So, if you work out some kind of angle within the map' | + | So, if you use conventional math to calculate a rotation |
This way of calculating rotations is tied to the engine, and therefore used in any and all game objects that can have some kind of rotation. That includes units, their individual component objects and notably, the camera. | This way of calculating rotations is tied to the engine, and therefore used in any and all game objects that can have some kind of rotation. That includes units, their individual component objects and notably, the camera. | ||
Line 82: | Line 83: | ||
</ | </ | ||
- | <=[[cw4:scripting| Scripting]] | + | <=[[4rpl:tutorials| Tutorials]] |