chasecam keeps getting hidden by objects

Blitz3D Forums/Blitz3D Beginners Area/chasecam keeps getting hidden by objects

chrisnorris007(Posted 2009) [#1]
can someone check out this updatechasecam function and tell me how to make it NOT get impeded by objects?

; chasecam functionality
Function UpdateChaseCam( c.chasecam )
	
	If KeyDown(200)
		TranslateEntity c\heading,0,-3,0
	Else If KeyDown(208)
		TranslateEntity c\heading,0,+3,0
	EndIf
	
	dx#=EntityX(c\target,True)-EntityX(c\camera,True)
	dy#=EntityY(c\target,True)-EntityY(c\camera,True)
	dz#=EntityZ(c\target,True)-EntityZ(c\camera,True)
	
	TranslateEntity c\camera,dx*.1,dy*.1,dz*.1
	
	PointEntity c\camera,c\heading
	
	PositionEntity c\target,0,0,0
	ResetEntity c\target
	PositionEntity c\target,0,3,-10
	
End Function

Function CreateChaseCam.ChaseCam( entity )
	
	c.ChaseCam=New ChaseCam
	c\entity=entity
	c\camera=CreateCamera()
	c\target=CreatePivot( entity )
	PositionEntity c\target,0,3,-10
	EntityType c\target,TYPE_TARGET
	
	c\heading=CreatePivot( entity )
	PositionEntity c\heading,0,0,20
	
	CameraRange c\camera, 0.05, 1000
	Return c
	
End Function



Ross C(Posted 2009) [#2]
Navigating around objects is no easy matter. You would need to ,every loop, reset your collision type for the camera (or whatever is colliding), start your camera's position at the mesh your following, set your collision type back up, and move your camera back to where it's supposed to go.

That way, you can be sure your camera won't be getting stuck.


Stevie G(Posted 2009) [#3]
There's a smart cam in the code archives by Ant ( Banned in the line of duty ). It's not perfect but you should be able to take the parts you need.


Naughty Alien(Posted 2009) [#4]
..I would use some of the physics libs and do raypicking between cam and character camera chasing..anything returned but character, move cam towards character until character pick is return..