Page 1 of 1
Camera control help
Posted: Wed Aug 04, 2021 8:22 pm
by KoolGamer32
I was wondering how the whole camera control thing works. I can't find really any sources I can understand clearly and was wondering if anyone had a kind of basic guide on how that all works. For example for my one level I want to zoom in to a point and zoom out a few seconds later.
Re: Camera control help
Posted: Wed Aug 04, 2021 9:26 pm
by Marioman2007
Re: Camera control help
Posted: Thu Aug 05, 2021 10:41 am
by KoolGamer32
thanks for the help on that area but I am still a bit confused. I also need help with how to even load it if i need a script or what. I would also like to know how to trigger camera control at specific points in the level similar to an event triggered by a trigger
Re: Camera control help
Posted: Thu Aug 05, 2021 12:07 pm
by Hoeloe
KoolGamer32 wrote: ↑Thu Aug 05, 2021 10:41 am
thanks for the help on that area but I am still a bit confused. I also need help with how to even load it if i need a script or what. I would also like to know how to trigger camera control at specific points in the level similar to an event triggered by a trigger
You need to load handycam with the line:
Code: Select all
local handycam = require("handycam")
From there, you can then use the onEvent function to use SMBX events to trigger zooming in and out:
Code: Select all
function onEvent(name)
if name == "Zoom In" then
handycam[1].zoom = 2
elseif name == "Zoom Out" then
handycam[1].zoom = 1
end
end
If you want to get
really fancy, you can, instead of just setting the zoom level, use the queue function, like so:
Code: Select all
handycam[1]:queue{ zoom = 2, time = 1 }
To allow for some transitioning. Note the use of a colon instead of a dot, and the use of curly braces instead of brackets.
Re: Camera control help
Posted: Thu Aug 05, 2021 2:14 pm
by KoolGamer32
thanks that completely solves that issue but I am still unsure of how to place the camera in a specific spot. I have tried adding x and xoffset to this line of code handycam[1]:queue{ xOffset = 10, zoom = 2, time = 4 } nothing. I have tried adding it as a separate line entirely handycam[1].xOffset = 10. But the camera doesnt move and just zooms in to the center. I thought maybe camera target would probably get the result i want but im not sure how to code that. tldr: I want the camera to transition to a specific spot that isnt the center as well as zooming in. (which i know how to zoom in already thanks to the previous reply)
Re: Camera control help
Posted: Thu Aug 05, 2021 6:38 pm
by Hoeloe
Hrm, xOffset should work just by adding it to the queue like you did... You can also assign any object with an x and y coordinate as the "target" in a queue call. Not really sure what's wrong there... (though 10 is quite small - it's less than a third of a block's width, so maybe that's the issue?)