Rotation Help - Spinning around a model

Blitz3D Forums/Blitz3D Programming/Rotation Help - Spinning around a model

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.

I'm still getting to grips with Blitz 3d and I'm having trouble with what seems a simple problem. I have a model that I would like to rotate the camera around, and have the camera always face the model.

My model is located at 10,10,10

The following tries to rotate around the y-axis, but seems to flip around 90 and 270 degrees:
PositionEntity camera, (cos(degs)*3) + 10, 10, (sin(degs)*3) + 10
point_entity(camera, 10, 10, 10)


point_entity is from the code archives:
Function Point_Entity(entity,x#,y#,z#)
	xdiff# = EntityX(entity)-x#
	ydiff# = EntityY(entity)-y#
	zdiff# = EntityZ(entity)-z#

        dist#=Sqr#((xdiff#*xdiff#)+(zdiff#*zdiff#))
	
	pitch# = ATan2(ydiff#,dist#)
	yaw#   = ATan2(xdiff#,-zdiff#)

	RotateEntity entity,pitch#,yaw#,0
End Function


Eventually I would like to control the movement via the cursor keys. Does anyone have advice/code to do this?