thanks, but i know the method, my problem is how to implement that
i try this code:
If Scene.AdvancedCollision(l_Start2, l_End, collres, TV_COLLIDE_ACTOR2, TV_TESTTYPE_BOUNDINGBOX Or TV_TESTTYPE_ACCURATETESTING, True) = False Then
FallTime = FallTime + 1
EyePos.Y = EyePos.Y - 0.1 * FallTime
If EyePos.Y < LandHei(EyePos.X, EyePos.z) + PlayerHei Then EyePos.Y = LandHei(EyePos.X, EyePos.z) + PlayerHei: FallTime = 0
Else
If collres.collisionimpact.Y < EyePos.Y Then
FallTime = FallTime + 1
EyePos.Y = EyePos.Y - FallTime * 0.1
If EyePos.Y < collres.collisionimpact.Y + PlayerHei Then EyePos.Y = collres.collisionimpact.Y + PlayerHei: FallTime = 0
Else
EyePos.Y = collres.collisionimpact.Y + PlayerHei
End If
End If
the original code is sample from tv3d:
' GRAVITY TEST
' Do a vertical check from the player position + 10 to the landscape.
Dim Coll As TV_COLLISIONRESULT
Dim test As Boolean
test = Scene.AdvancedCollision(Vector3(ActorPosition.x, ActorPosition.y + 10, ActorPosition.z), Vector3(ActorPosition.x, LandHeight, ActorPosition.z), Coll, TV_COLLIDE_MESH, TV_TESTTYPE_ACCURATETESTING, True)
If test = False Then
' there is nothing else than landscape below the actor, so the actor must fall
ActorPosition.y = ActorPosition.y - TV.AccurateTimeElapsed * 0.1
If ActorPosition.y < LandHeight Then ActorPosition.y = LandHeight
Else
' check the impact point of collision
If Coll.collisionimpact.y < ActorPosition.y Then
' if impact is below actor, it must fall,
ActorPosition.y = ActorPosition.y - TV.AccurateTimeElapsed * 0.1
If ActorPosition.y < Coll.collisionimpact.y Then ActorPosition.y = Coll.collisionimpact.y
Else
'else it must go up
ActorPosition.y = Coll.collisionimpact.y
End If
End If
End If
(vb\tutorials\b15 - advanced collision)
why its not work
