Hey guys,
I work at the moment at third person and I know the reason for the clipping.
At the moment the cam checks for a collision and if it find one it sets the camera on this point.
The problems are:
1) We not always find the best point for the camera, because the raycast override the point
2) The cam has a field of view and is not a point, so we need to set it a bit in front of the collision point
My try is a bit strange (at line 1402 in gameplayercontrol):
-- we need to place the camera away from the Colision point otherwise we can look in the object
Text(1,2,2,tffdcx-tthitvaluex .."="..tthitvaluex.."-"..tffdcx)
Text(1,4,2,tffdcz-tthitvaluex .."="..tthitvaluez.."-"..tffdcz)
ttcoldistX = (tffdcx-tthitvaluex)*-0.01+8
ttcoldistZ = (tffdcz-tthitvaluex)*-0.01+8
--if ttcoldistX > 0 then ttcoldistX = 8 else ttcoldistX = ttcoldistX*-0.001+8 end
--if ttcoldistZ > 0 then ttcoldistZ = 8 else ttcoldistZ = ttcoldistX*-0.001+8 end
ttddx=ttpx-tthitvaluex
ttddy=ttpy-tthitvaluey
ttddz=ttpz-tthitvaluez
ttdiff=math.sqrt(math.abs(ttddx*ttddx)+math.abs(ttddy*ttddy)+math.abs(ttddz*ttddz))
if ( ttdiff>12.0 ) then
ttddx=ttddx/ttdiff
ttddy=ttddy/ttdiff
ttddz=ttddz/ttdiff
tffdcx=tthitvaluex+(ttddx*5.0)+ttcoldistX
tffdcy=tthitvaluey+(ttddy*1.0)
tffdcz=tthitvaluez+(ttddz*5.0)+ttcoldistZ
SetGamePlayerControlLastGoodcx(tffdcx)
SetGamePlayerControlLastGoodcy(tffdcy)
SetGamePlayerControlLastGoodcz(tffdcz)
SetGamePlayerControlCamCurrentDistance(ttdiff)
SetGamePlayerControlCamDoFullRayCheck(1)
else
tffdcx=GetGamePlayerControlLastGoodcx()
tffdcy=GetGamePlayerControlLastGoodcy()
tffdcz=GetGamePlayerControlLastGoodcz()
end
It is a bit better now with terrain collision, but entity collision is still broken on the right side.
Maybe someone can point me a better way or a way to improve this
Thanks
Ebe Editor Free - Build your own EBE structures with easy and without editing any text files
Thread and Download