Cam Code Help

Blitz3D Forums/Blitz3D Programming/Cam Code Help

CodeOrc(Posted 2007) [#1]
I am seeking camera code that will do the following;

1. Look at an object located at 0,0,0.
2. Orbit the 0,0,0 both left and right in 360 degree.
3. Orbit 0,0,0 both up down 360 degree.

I have the left/right part, but for the life of me cannot get it to go around it 360 in all directions...argh! hehe

Anyone have a code snippet they would not mind passing along for this?


jfk EO-11110(Posted 2007) [#2]
maybe you could do this:

Graphics3D 800,600,32,2
SetBuffer BackBuffer()


camera=CreateCamera()


cube=CreateCube()

light=CreateLight()
RotateEntity light,45,45,0


r#=10


While KeyDown(1)=0
 a1#=(a1#+0.5) Mod 360
 a2#=(a2#+1.33) Mod 360
 PositionEntity camera,Sin(a1)*r,Cos(a2)*r,Cos(a1)*r
 PointEntity camera,cube
 ;RotateEntity camera,EntityPitch(camera),EntityYaw(camera),0
 RenderWorld()
 Flip
Wend


Tho I doubt this is the correct math solution :o)


Rroff(Posted 2007) [#3]
Why not just parent the camera to a pivot thats at 0,0,0 use the pointentity command to get it looking at it, then rotate the pivot as needed (which will affect the camera as its a child of that object)