I’m currently creating a game with 2d physics objects and I want to have an object detect if a scene was clicked/held by the player’s mouse.
If it matters here’s the node tree for the object.
-Rigidbody2D
-Sprite2D
-CollisionShape2D
I’m currently creating a game with 2d physics objects and I want to have an object detect if a scene was clicked/held by the player’s mouse.
If it matters here’s the node tree for the object.
-Rigidbody2D
-Sprite2D
-CollisionShape2D
You can get scene_file_path
from any node, since your object’s scene is structured with the rigid body as the root this should always have the scene_file_path
available.
if held_object.scene_file_path == "res://my_object.tscn":
print("holding my object!")
I’m confused what does this do?
Step-by-step