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] - [Matrix1] Basic Editor Based WASD Camera Movement Template

Author
Message
Chris Tate
DBPro Master
15
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 1st Jul 2015 20:53 Edited at: 8th Jul 2015 22:04
This editor camera movement template can be used in any new in DarkBASIC professional project; no need to write a camera movement program every time you start a new project.

The snippet provides your program with basic editor based WASD movement support with fly cam and pan cam modes. In fly mode you can move around a large area, in pan mode you track a certain coordinate while panning and moving the camera.

You invoke pan movement by supplying a vector to track.

[W] Move Forward
[A] Move Left
[S] Move Backward
[D] Move Right

(Duh!!)

[CTRL] = Move fast
[SHIFT] = Move slow
[E] = Pitch up
[W] = Pitch down
[Mouse movement] Pan and rotate

The code is self explanitory, use at will. Many thanks to IanM for his Matrix1 plugin and keyboard constants. I have also added some utility functions and shortcuts from my own project to enhance the user experience and your further development of your programs.




Login to post a reply

Server time is: 2024-04-19 01:30:00
Your offset time is: 2024-04-19 01:30:00