CodeBase - Mouse Look and Strafing

Return to the CodeBase listing

Category: Basic 3D

Version: 1.1



Uploaded: 7th Oct 2003 17:55

Modified: 8th Oct 2003 11:11

Author:  Ronaldaveo


Basic FPS mouse look, WASD movement and strafing for beginners.

Full Description

Simple Explanation:<br /> <br /> if keystate(17)=1<br /> x# = newxvalue(x#,wrapvalue(camera angle y()),1)<br /> z# = newzvalue(z#,wrapvalue(camera angle y()),1)<br /> endif<br /> <br /> The number 17 represents the &quot;scancode&quot; of the keyboard key &quot;w&quot;.<br /> The keystate command will return a &quot;1&quot; if the key is currently being pressed.<br /> x# and z# represent the camera's position in the 3D world.<br /> The newx and newz value commands will find new co-ordinates in a 3D space based on the infomation passed into the command.<br /> so the above basically means:<br /> newcamera postion = new value(current position, direction, distance to travel)<br /> Similar to mathematical vectors but with none of the working out :)


No comments yet.