fancy camera footwork

Blitz3D Forums/Blitz3D Beginners Area/fancy camera footwork

gellyware(Posted 2003) [#1]
Anyone know where to find a tutorial on fancy camera footwork using pivots? What I have is 7 cylinders all in a line spaced apart. When you click the cylinder, it becomes active. I want the camera to slowly move to a position a little bit behind the cylinder. Right now this is preliminary for a more complex camera system. Eventually I will have cylinders to the left and right and the camera will find a distance between 2 cylinders and move towards a certain point and turn accordingly. Any suggestions? Ive tried numerous things to no avail :)


Rob Farley(Posted 2003) [#2]
; Smooth camera movement
; 2003 Rob Farley
; http://www.mentalillusion.co.uk
;
; If you use this credit would be appreciated, cheers, Rob.

Graphics3D 640,480

SetBuffer BackBuffer()

; create scene
a=CreateMesh()
For n=0 To 199
b=CreateCube()
PositionMesh b,Rand(-20,20),Rand(-20,20),Rand(-20,20)
ScaleMesh b,Rnd(.1,2),Rnd(.1,2),Rnd(.1,2)
RotateMesh b,Rand(0,360),Rand(0,360),Rand(0,360)
AddMesh(b,a)
FreeEntity b
Next


; create camera and light
camera=CreateCamera()
light=CreateLight()
PositionEntity light,200,100,0


; a couple of pivots to control it
camera_pointer=CreatePivot()
target=CreatePivot()
camera_director=CreatePivot()
camera_target=CreatePivot()

; set up initial position
PositionEntity camera,0,0,-20
PositionEntity camera_pointer,0,0,0





Repeat

; this moves the bits around, the /100 is how much smoothing /10 for example would be much faster response
PointEntity camera_pointer,target
MoveEntity camera_pointer,0,0,EntityDistance(camera_pointer,target)/100 ;this is for the target
PositionEntity camera_director,EntityX(camera),EntityY(camera),EntityZ(camera)
PointEntity camera_director,camera_target
MoveEntity camera_director,0,0,(EntityDistance(camera_target,camera_director)/100) ; this for the camera
PositionEntity camera,EntityX(camera_director),EntityY(camera_director),EntityZ(camera_director)
PointEntity camera,camera_pointer

UpdateWorld
RenderWorld


; press space to randomize positions
Color 255,0,0
Text 320,0,"Press Space to Randomise Position, Esc to quit",True
Flip

If KeyHit(57)
	PositionEntity target,Rand(-20,20),Rand(-20,20),Rand(-20,20)
	PositionEntity camera_target,Rand(-20,20),Rand(-20,20),Rand(-20,20)
	EndIf

Until KeyHit(1)


End



gellyware(Posted 2003) [#3]
Very nice! Thank you, Ill play around with it a bit :) Amazing!