Get camera position: Difference between revisions
(Transferred the page from the old wiki) |
(Added to a category) |
||
Line 6: | Line 6: | ||
If that's not a problem for you, [https://play.fancade.com/5C67367D142708D2 here's] an example by [[The Questers#Mathias Elgaard|Mathias Elgaard]]. | If that's not a problem for you, [https://play.fancade.com/5C67367D142708D2 here's] an example by [[The Questers#Mathias Elgaard|Mathias Elgaard]]. | ||
(Or try to figure it out yourself, it's fun!) | (Or try to figure it out yourself, it's fun!) | ||
[[Category:Scripting]] |
Revision as of 19:43, 20 June 2024
Unfortunately, there is no built-in "Get Camera" block. The easiest way to get around that is to save the camera's parameters in Variable#Global variables while (or instead of) setting them with Set Camera, then reading from them when needed.
If that's not an option for you (for example, if you're making a custom block for everyone to use), it is possible to calculate the camera's parameters with Screen To World and some clever math. However, this will lag behind the real camera by one frame, as Screen to World uses the current frame's camera, while Set Camera affects the next frame. If that's not a problem for you, here's an example by Mathias Elgaard. (Or try to figure it out yourself, it's fun!)