Posted: 12th Jan 2003 2:20
Can someone tell me how to get a camera to rotate around an Object on all 3 axes? The code I have doesn't quite do what I need it to do. Because it doesn't rotate or anything around the object.

+ Code Snippet
cX#=Camera Position X()
cY#=Camera Position Y()
cZ#=Camera Position Z()

a#=wrapvalue(a#+1)
   If InKey$()="w" Then Position Camera cX#,PosY#+(Sin(a#)*PosY#),cZ#
   If InKey$()="s" Then Position Camera cX#,PosY#-(Sin(a#)*PosY#),cZ#
   If InKey$()="a" Then Position Camera PosX#+(Sin(a#)*PosX#),cY#,PosZ#-(Sin(a#)*PosZ#)
   If InKey$()="d" Then Position Camera PosX#-(Sin(a#)*PosX#),cY#,PosZ#+(Sin(a#)*PosZ#)
Point Camera PosX#,PosY#,PosZ#
Posted: 17th Jan 2003 14:44
Sometimes i use this (in the loop)

+ Code Snippet
ox#=object position x('object to rotate around')
oy#=object position y('object to rotate around')
oz#=object position z('object to rotate around')

`position the camera on the object
position camera ox#,oy#,oz#

`rotate the camera on the variables cax#,cay#,caz#
rotate camera cax#,cay#,caz#

move camera -('distance away from object')
Posted: 17th Jan 2003 23:44
This might be like what you're looking for.

+ Code Snippet
sync on
sync rate 30
hide mouse
autocam off

make matrix 1,1000,1000,5,5
make object box 1,100,100,100
position object 1,500,50,500

do
a#=wrapvalue(a#+mousemovex())
b#=wrapvalue(b#+mousemovey())

position camera 500+(sin(a#)*cos(b#)*500),50+(sin(b#)*500),500+(cos(a#)*cos(b#)*500)
point camera 500,50,500
sync
loop
Posted: 28th Apr 2003 0:10
Hi! I'm new at DB and certenly at 3D math!...I've came accross this very interesting post and I found the little snippit posted by TheDarthster very usefull to my purpose too!...the only problem I'm having is the view suddenly reversing while the camera rot reaches xRot#=90 or -90.
Is there any chances to fix that?...Much appriciated