Try my new website:
www.urcho.com
- the new SIMPLE social network
Sign up
|
357
members |
125
snippets
Search for:
ALL
POPULAR
File Controls
Multiplayer Code
2D Effects
3D Effects
Oldskool demos
Basic Functions
Maths/Physics
Sound
Tutorials
Misc
Username:
Password:
Sign up
Beginners - Simple Mouselook Camera
[
back
]
Author:
Stardog
| Viewed:
1227
times | Language:
BlitzBasic 3D
| Category:
Basic Functions
;VIDEO MODE Graphics3D 800,600 SetBuffer BackBuffer() ;GLOBALS - CAMERA Global cam_pivot = CreatePivot() Global cam_pivot2 = CreatePivot(cam_pivot) Global camera = CreateCamera(cam_pivot2) ;OBJECTS light=CreateLight() cube=CreateCube() PositionEntity cube,0,0,10 ;FUNCTIONS Function MouseLook() x_speed# = x_speed * 0.2 + MouseXSpeed() * 0.2 y_speed# = y_speed * 0.2 + MouseYSpeed() * 0.2 z_speed# = z_speed * 0.2 + MouseZSpeed() * 0.2 MoveMouse GraphicsWidth()/2,GraphicsHeight()/2 TurnEntity cam_pivot,0,-x_speed,0 TurnEntity cam_pivot2,y_speed,0,0 End Function Function MoveKeys() If KeyDown(200) ;UP - forward MoveEntity cam_pivot,0,0,0.5 End If If KeyDown(208) ;DOWN - backword MoveEntity cam_pivot,0,0,-0.5 End If If KeyDown(203) ;LEFT - turnleft MoveEntity cam_pivot,-0.5,0,0 End If If KeyDown(205) ;RIGHT - turnright MoveEntity cam_pivot,0.5,0,0 End If If KeyDown(30) ;UP MoveEntity cam_pivot,0,0.5,0 End If If KeyDown(44) ;DOWN MoveEntity cam_pivot,0,-0.5,0 End If End Function ;MAIN GAME LOOP While Not KeyHit(1) MouseLook() MoveKeys() UpdateWorld RenderWorld Text 1,1,"Program Text" Flip Wend End
Author Comments:
Simple mouse-look camera for beginners.
Login or
create an account
to comment on this snippet