Camera following a meshBlitzMax Forums/MiniB3D Module/Camera following a mesh
| 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 pos.PointEntity(target) pos.MoveEntity(0,2,0) ElseIf dist<mindistance Then pos.PointEntity(target) pos.MoveEntity(0,-2,0) End If pos.RotateEntity(0,0,0,True) cam.PointEntity(target) 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.
| 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
| mmm, any miniB3D version? I've not experience on Blitz3D |
| Well, Since MiniB3D IS B3D for BlitzMax then you should have no problem converting the code. |
| 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
| Thanks! |
|Frosty Beverage Fund|