How to set up 3-D collisions?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By 1997
:warning: Old Version Published before Godot 3 was released.

I’ve got a space ship that is moving through a bunch of asteroids however the ship goes through the asteroids. both the ship and the asteroids have collision shapes. the ship is RigidBody and the asteroids are Static. I want the space ship to stop moving when it collides with an asteroid(game over), but I don’t know where to begin.

is it possible to use collision detection with rigidbody or do I have to use kinematicbody?

1997 | 2016-05-18 16:54

:bust_in_silhouette: Reply From: 1997

I’ve got collisions working by having an object with a collision shape(asteroid) and put an Raycast on the ship. then you can just adds some code like

var ray = get_node(“Raycast”)
if ray.is_colliding():
#something happens like death