i, I am making a third person role playing game and I want to know how to add a chase cam to "player".
Here is the code:
Graphics3D 1024,768,32,1
SetBuffer BackBuffer()
Include "settings.bb"
AmbientLight 255,255,255
light=CreateLight()
world=createplane()
PositionEntity world,0,-20,0
EntityColor world,0,255,0
sky=CreatePlane()
RotateEntity sky,0,0,180
PositionEntity sky,0,100,0
EntityColor sky,0,255,255
;Camera
Global camera=CreateCamera()
CameraViewport camera,50,50,GraphicsWidth()/1.25,GraphicsHeight()/1.25
Global player=CreateCube()
;Positioning
PositionEntity player,0,0,5
;collisions
EntityType player,1
EntityRadius player,1.0
EntityType world,2
Collisions 1,2,2,2
gravity#=.05
yvel#=0
While Not KeyDown(1)
If KeyDown(17)
MoveEntity player,0,0,0.15
EndIf
If KeyDown(31)
MoveEntity player,0,0,-0.15
EndIf
If KeyDown(30)
TurnEntity player,0,2,0
EndIf
If KeyDown(32)
TurnEntity player,0,-2,0
EndIf
If KeyHit(57)
FlushKeys()
yvel=.5
EndIf
If EntityCollided(player,world) Then
yvel = 0
Else yvel = yvel - gravity
EndIf
TranslateEntity player,0,yvel,0,True
;End stuff
FlushKeys()
UpdateWorld
RenderWorld
Flip
Wend
End
If you can help, thanks. If not, oh well.
|