|Topic was automatically imported from the old Question2Answer platform.
According to the docs the
use_collision flag “Adds a collision shape to the physics engine for our CSG shape. This will always act like a static body.”
If it acts like a static body shouldn’t there be a
mouse_entered() signal in the node?
How is the collision shape accessed?
I’m trying to create a selectable object using CSGShapes.
You could use raycasting from the camera to get the clicked CSGShape.
Look in this Q&A for inspiration (this probably is for Godot 2.x but should also be usable in Godot 3.x):
You’ll see that they use
_fixed_process (now called
_physics_process) to cast out rays to the mouse position.
camera.project_ray_origin(mouse_pos) does the conversion of a mouse-position to a 3d position to be used in a raycast.
You’d probably have to set a variable (
mouse_pos) in the camera script which saves the last mouse position delivered to
So raycasting detects the static body in CSGShape. Tested and it works!
bborncr | 2019-04-15 16:05