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.

Code Snippets / [DBP] Mouse Rotated Camera

Author
Message
300happy
16
Years of Service
User Offline
Joined: 21st Feb 2008
Location: Indiana, USA
Posted: 5th May 2009 00:58
This is some pretty simple code, but I spent the afternoon making it as I'm learning DBPro, and thought I would share it since I couldn't find a plain, simple example of doing this.

What this code does:

Allows positioning the camera around a 3d point, using mouseXYZ to control rotation, angle, and zoom. Limits Y rotation to prevent going over 90 degrees. Z is also limited to zooming between min and max values.

If you've ever played games like Prince of Persia or Assassin's Creed, this will feel very familar to you.

Should be easy enough to add to your own project, and is as well commented as I could come up with.

Code:

Login to post a reply

Server time is: 2024-11-22 01:01:22
Your offset time is: 2024-11-22 01:01:22