Page 1 of 1

Crude attempt at fly-by camera

Posted: Sat Nov 29, 2014 12:49 pm
by mahric
Hi everyone,

Here's my crude attempt at a fly-by camera. (video, source example)
(if possible, watch with chrome @60fps to see how it really looks in game)

With it, you can do stuff like:
- Introduce a new area or a boss with a fly-by
- Show the player where to go

To create a "fly by", simply add points to your trajectory with the function below:

Code: Select all

mdCam.script:addPoint(x, y, facing)

	x = the x position in the editor where you want the camera to go
	y = the y position in the editor where you want the camera to go
	facing = the way the camera needs to look when arriving at the point (0 = north, 1 = east, 2 = south, 3 = west)
After you have added all points, start the fly-by with the function below:

Code: Select all

mdCam.script:startCam(duration)

	duration = the number of second the total flight should take
There are lots of known issues:
- There is some smoothing, but it's very crude and/or or not done at all. The faster the camera goes the easier it's to notice.
- There is only support for elevation (because I didn't need it myself yet)
- You fly through the area but don't hear the sounds. That's because you hear the sounds where the party is instead of where the camera is.

Please feel free to use this, change it and/or completely rework it.
This is just a basic attempt from my side with all the stuff I needed.

Hope you can use it in your project. For full instructions read the readme file in the example, in the mod_assets/mdCam folder.

Re: Crude attempt at fly-by camera

Posted: Sat Nov 29, 2014 3:22 pm
by Drakkan
impressive work !
edit: is the camera abel to fly between different maps / levels ?

Re: Crude attempt at fly-by camera

Posted: Sat Nov 29, 2014 3:54 pm
by mahric
No, the camera can't fly between levels. I don't think the game engine loads the graphics for the adjacent levels.
Every visible transition in the game to another level is through a fade-out and fade-in.

The current demo only works for the level where the character is in anyway.

To fly trough seperate level you'd have to define seperate sets of points, use fade-out and fade-ins to transition between them and move the player from one map to the next.
That requires quite a bit of scripting. Not hard, but very tailored to a specific dungeon.

Re: Crude attempt at fly-by camera

Posted: Sat Nov 29, 2014 10:09 pm
by Isaac
This is really cool! 8-)

I haven't looked at the source yet... but I wonder, could your next version look for/detect invisible marker objects that have an x/y/e location, and track to them along the path from a to b?

Re: Crude attempt at fly-by camera

Posted: Sun Nov 30, 2014 6:27 am
by Komag
Wow, I'm pretty impressed!