0 votes

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.

in Engine by (61 points)

1 Answer

0 votes
Best answer

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 _input(event)

by (3,350 points)
selected by

So raycasting detects the static body in CSGShape. Tested and it works!


Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.