Camera Rotation Help PLZ

Blitz3D Forums/Blitz3D Beginners Area/Camera Rotation Help PLZ

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

if you want to be able to orbit around the payer, I take it you want to do that with the mouseXSpeed, right?

you may use sin/cos to position your camera, somethng like:

dis#=15

while keydown(1)=0 ; main loop

; do things...

; orbit code
x#=entityx(player)
y#=entityy(player)
z#=entityz(player)
positionentity camera,x+(sin(a)*dis),y+5,z+(cos(a)*dis)
pointentity camera,player
rotateentity camera, entitypitch(camera),entityyaw(camera),0

renderworld()
flip

; handle mouse orbit 
movemouse graphicswidth()/2,graphicsheight()/2
a=a+ mousexspeed()
if a<0 then a=a+360
if a>360 then a=a-360

dis=dis+mousezspeed() ; mousewheel to zoom
if dis<5 then dis=5
if dis >25 then dis=25

wend


This is of course only a very basic skeleton. For a good camera handling you should smooth things, using rubberband alignement, and probably AlignToVector for smooth rotation.

Additionally you may need an obstacles handler, this is going to make your zoom routine more complex.