Arrows going through terrain.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Joel_127

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 bow_power = -40
arrow.apply_central_impulse (arrow.get_global_transform().basis.z.normalized() * bow_power)

How can I prevent my arrow from going through the terrain ?

Thanks in advance

:bust_in_silhouette: Reply From: Technipion

This might be a simple “bullet through paper problem”. Try to enable continuous collission detection (CCD) for the arrow.

Thanks a lot, I don’t know how I missed this option! :slight_smile:

Joel_127 | 2019-04-10 17:49