Login or Signup

Camera following a mesh

BlitzMax Forums/MiniB3D Module/Camera following a mesh

ziggy1+ years ago #1
I've got this method on my 'camera' type, but I really don't like how it follows the 'main' character of the game I'm writing, I'm sure there will be a better algorithm for camera 'following' the main character. This is the code I'm using right now, any suggestion will be apreciated:

	Method Update()
		Local Dist:Float
		If target = Null Then Return
		Dist = cam.EntityDistance(target)
		If dist>maxdistance Then
		ElseIf dist<mindistance Then
		End If
	End Method

Target is the mesh that has to be followed by the camera.
Pos is a pivot that is part of the camera object, it is used to place the camera.
cam is the camera object, contained as a filed on my camera type.

Amon1+ years ago #2
This is B3D code but should work with MiniB3D. It was coded by Antony and imo is a totally cool way for having a camera follow a mesh while avoiding obstructions.

Link here : http://www.blitzbasic.com/codearcs/codearcs.php?code=1083

ziggy1+ years ago #3
mmm, any miniB3D version? I've not experience on Blitz3D

Amon1+ years ago #4
Well, Since MiniB3D IS B3D for BlitzMax then you should have no problem converting the code.

bradford61+ years ago #5
some nitwit by the name of 'bradford6' posted this 5 yrs ago:

so i went ahead and updated it for the animated robot demo

get the robot demo here:

or if you already have it, drop this code in the Robot Animtest folder

ziggy1+ years ago #6

Blitz Social Club