camera rotate around object help

Blitz3D Forums/Blitz3D Programming/camera rotate around object help

Picklesworth(Posted 2004) [#1]
I am trying to make my camera rotate around an object.
I can get rotation the object around the object for rotation on the y axis, but could I please get a little help for the x axis? For some reason it isn't wanting to work properly...
	;moving camera in and out
	MoveEntity camera,0,0,MouseZSpeed()*2 ;WORK ON THIS A BIT
		
	;rotating camera
	
	mouseXs# = MouseXSpeed()
	mouseYs# = MouseYSpeed()
	
	;check to see how far away the camera is from the center and save to a variable
	;this will make the rotation functions work properly.
	;FIX THIS DYLAN YOU IDIOT
	distance = EntityDistance(camera,centerpoint) 
	
	If MouseDown(2)
		
		roty# = rotY# + mouseXs#
		
		camx# = Cos(rotY)*distance
		camz# = Sin(roty)*distance
		
		PositionEntity camera,camx#,0,camz#		
		PointEntity camera,centerpoint
					
	EndIf



Picklesworth(Posted 2004) [#2]
okay, never mind, I just parented the camera to a pivot and it seems to work. Bye!