In my game I have a bow that fires arrows. The arrows are rigidbodies with a small elongated capsule covering the arrow shaft and have a raycast node the length of the arrow to detect when it hits. The terrain is a mesh with trimesh collider.
It works very well most of the time, but sometimes the arrow goes through the terrain. The hit is always detected. Here is the code used to fire the arrow:
var bowpower = -40
arrow.apply_central_impulse (arrow.get_global_transform().basis.z.normalized() * bowpower)
How can I prevent my arrow from going through the terrain ?
Thanks in advance