Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Dolly Zoom

Author
Message
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 5th Feb 2010 05:28 Edited at: 10th Feb 2010 08:55
Not entirely sure if I've already posted this.

This is my attempt to emulate the "dolly zoom" camera effect.
Dolly zoom is when the camera is moving away from the object that it is zooming in on. This makes the focal object appear to be stationary and remain the same size while objects in the background appear to move inwards.
The opposite effect can be achieved by moving the camera towards to focal object and zooming out.

I want to make a whole library of cinematic commands like this to make it easier to produce cut-scenes and what not with DBC.
[edit: removed old version, check last post.]

"With games, we create these elaborate worlds in our minds, and the computer is there to do the bookkeeping." - Will Wright
Caleb1994
15
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 5th Feb 2010 05:47
That's really cool! Good job obese! It was a little shaky the first time a ran it but after that it ran really smooth.

New Site! Check it out \/
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 6th Feb 2010 07:22
Thanks
It runs a bit shaky for me too, I don't know why.

"With games, we create these elaborate worlds in our minds, and the computer is there to do the bookkeeping." - Will Wright
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 6th Feb 2010 08:16
Quote: "Thanks
It runs a bit shaky for me too, I don't know why."

Keep your eye on the order of events. Do your camera movement before adjusting the field of view. I believe setting the FOV calls an automatic sync. So try:




You also may be able to save yourself some code and use LOCK OBJECT ON for all the foreground objects that stay stationary as the scene around changes with the field of view adjustments. You shouldn't have to reposition the camera at all. The FOV will take care of the zoom and the locked objects should retain their relative positions.

Enjoy your day.
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 9th Feb 2010 13:07 Edited at: 10th Feb 2010 08:56
Quote: "Keep your eye on the order of events. Do your camera movement before adjusting the field of view. I believe setting the FOV calls an automatic sync."

Thanks Latch that makes it so much smoother
I've edited the original code.

[edit]
Turned it into a function. Well, it seems to lag slightly when I squeeze it into one function so I've also included two independent functions for zooming in and out.
[edit: removed old version]

Quote: "You also may be able to save yourself some code and use LOCK OBJECT ON for all the foreground objects that stay stationary as the scene around changes with the field of view adjustments."

The principle of this is that you can just plug it into any program and start using it. I wouldn't know how to figure out which objects needed to be locked on-the-fly.

"With games, we create these elaborate worlds in our minds, and the computer is there to do the bookkeeping." - Will Wright
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 10th Feb 2010 04:34
Quote: "I believe setting the FOV calls an automatic sync."

I wrote that giving you a hint to not use a sync after a SET CAMERA FOV call - at least in DBC 1.20. You'll destroy your frame rates unnecessarily:



Enjoy your day.
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 10th Feb 2010 08:05 Edited at: 10th Feb 2010 09:01
oops

[edit]
I think I've cracked it in one function.
Syntax dollyzoom(distanc#,duration)
Distance is how far the camera will move each step.
Duration tells the function how many steps to run for.

The FOV is counter-balanced to keep the focal object roughly the same size in the frame.


"With games, we create these elaborate worlds in our minds, and the computer is there to do the bookkeeping." - Will Wright

Login to post a reply

Server time is: 2024-04-27 08:18:31
Your offset time is: 2024-04-27 08:18:31