Code archives/3D Graphics - Misc/First person perspective movement & mouselooking code

This code has been declared by its author to be Public Domain code.

Download source code

First person perspective movement & mouselooking code by Zethrax2004
*** Blitz3D Code ***


First person perspective movement and mouselooking code.

The code is heavily commented, so just grab it and go for it.

Note that movement, jumping, fake gravity, etc is not that convincing. Doing all that in a convincing manner is a much more involved process and this code is just designed to be a starting point.

EDITS:-
Added code to show a gun using a second camera.
Added a crosshair.
Updated mouselooking and movement code.
Converted to render tweening.
Added a graphics resolution selector.
Added jumping, sprinting, configurable strafe speed, and fake gravity.

The code is at: http://www.blitzbasic.com/codearcs/codearcs.php?code=1137

Comments

SgtSanders2006
Fantastic! Good work!


Boiled Sweets2006
Needs dampening


Trader35642007
Nice, but its not finished :( i can't jump, and not run, and i can walk up to over 90' hills if not more.
But hey, what has be done is great. Its a great start!!! I hope to work this out a bit more.


Zethrax2015
I've updated this a bit since I wrote the original code 10 years ago. The following things have been changed.

EDITS:-
Added code to show a gun using a second camera.
Added a crosshair.
Updated mouselooking and movement code.
Converted to render tweening.
Added a graphics resolution selector.
Added jumping, sprinting, configurable strafe speed, and fake gravity.


Code Archives Forum