Godot Version
4.3
Question
Hi folks! Hoping you can help me.
What I’m trying to do is move my player around and look at items in the world and display a text prompt. In this case I want the player to look at a computer screen and have a prompt appear to interact with it. Down the line this will launch a computer the player can interact with.
Here’s the situation:
- I import a glb mesh made in Blender into my project with -col to implicitly add the collision shape.
- It imports a Node3D with the StaticBody and CollisionShape inside the node.
- I want to add the following code to this object to make it interactable as I’m currently learning how to interact with objects in the game world.
extends CollisionObject3D
class_name Interactable
@export var prompt_message = "Interact"
- The issue I get is that I can’t attach this script to a Node3d. It gives me an error when I try to run the game.
- I change it to extend Node3d instead but my HUD prompt doesn’t appear when I look at the item in the game (it’s a random computer console I bashed together in Blender).
- When I have the root node as a StaticBody3d it works just fine but then I can’t import my model from Blender. I have Blender 4.x and it isn’t compatible with the importer.
I’d love to know the best approach to this. Is there a way to somehow expose the collider information on the root node so my object detection script can see it and display the prompt on-screen? Am I going about this in the wrong way altogether? Is there a way to get the Blender mesh into the right node type so I can script it? Any advice would be appreciated!