Jakuryusei Posted August 10, 2014 Share Posted August 10, 2014 The main focus of my game is story and dialogue, so I want to aim for a fairly cinematic experience. I'm sure I can make a scene FAIRLY pretty, but I'm not so sure how to frame it. How should I go about controlling the camera in LUA? Zooming in, centering on key areas, panning around the scene, rotating, that sort of thing. Quote Link to comment Share on other sites More sharing options...
Haydenmango Posted August 10, 2014 Share Posted August 10, 2014 Well I am not sure what exactly you want to do but here are some of the functions you would use - Camera Zoom - http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/camera/camerasetzoom-r207 Point at Entity (center in on entities) - http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/entity/entitypoint-r167 Move (good for panning and general camera movement because it doesn't detect collision) - http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/entity/entitymove-r165 Turn (Use this instead of SetRotation() to turn the camera over time) - http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/entity/entityturn-r29 There are many more (SetRotation(),SetPosition(), etc.) but these should be good enough to make a simple scene. Quote Check out my game Rogue Snowboarding- https://haydenmango.itch.io/roguesnowboarding Link to comment Share on other sites More sharing options...
Rick Posted August 10, 2014 Share Posted August 10, 2014 Using all the functions Haydenmango talked about via coroutines is a good way to get cinematic control. Couroutines in Lua allow you to create scripts that execute from top to bottom while holding their state and not blocking your game loop. It's an easy way to control state in a logical way. You could write scripts that look like: MoveToPoint(player, point) PlaySound("dialog.wav") PlayEmitter() RotateCamera() A script like the above would define functions that you would create and you would yield inside each on which basically comes out of the function and allows your game loop to go and then comes back into the function where it left off to continue it's work. Only until you say the function is finished would it then move to the next function in the list. Without something like coroutines maintaining state of cinematics can become messy and hard to follow. Here's a post I wrote about this. I've tested it in Leadwerks and it works. If I had time I would love to make a library of yieldable functions to use with this, but my time is limited these days. http://www.leadwerks.com/werkspace/topic/8092-blast-from-the-past-in-game-cut-scene/page__hl__coroutines Here is an example I did with this in LE 2. You have to turn the volume way up to hear the audio that I have but you can see I play audio, move cameras around and such. http://www.leadwerks.com/werkspace/topic/340-my-scene-scripting-library/page__hl__coroutines Quote Link to comment Share on other sites More sharing options...
YouGroove Posted August 10, 2014 Share Posted August 10, 2014 I encourage having a cinamatic camera different from your gameplay camera, and using pivots with specific names in the level. When cinematic camera is active it's script would move and rotate from pivot to pivot. Pivots with specific names would allow to play character sequence or particle effects when camera reaches it. For example in the cinematic camera Example : Pivot1Start Pivot2PlaySalute Pivot3Playexplosion Etc ... Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.