The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

+2 votes

There is get_rid() for resources. But there is no get_rid() for nodes (except, strangely, the single node type CollisionObject2D, which does have it). How do I get RID for any kind of instanced node?

There are many google hits making me think that get_rid() was perhaps a valid node method in Godot 2.0. It isn't in 3.0.x.

My specific need is to get RID for a MultiMeshInstance to set AABB. Unless someone can tell me otherwise, the only way to set AABB for a node instance (not a mesh) is using VisualServer.instance_set_custom_aabb ( RID instance, AABB aabb ). But I need RID for the MultiMeshInstance to do so.

I did try VisualServer.mesh_set_custom_aabb() on the MultiMesh, but that gives me an error telling me that my MultiMesh is not a Mesh (which I knew already). Setting AABB for the original Mesh used in the MultiMesh does not determine AABB of the MultiMesh or the MultiMeshInstance.

in Engine by (109 points)
edited by

Arghhh... does anyone know how to make the Q&A forum not garble underscores?
The methods I was trying to reference above are as follows (substitute underscore for dash):

The need for setting AABB on an instance is stated in the docs for MultiMesh: "Since instances may have any behavior, the AABB used for visibility must be provided by the user." Annoyingly, there are getaabb() methods everywhere but no setaabb() anywhere that I could use (not for MultiMesh or MultiMeshInstance or MultiMeshInstance inherited classes).
The method to do so using VisualServer is referenced here:

However, I'm still stuck since I don't know how to get the instance RID that I need to use in
VisualServer.instance-set-custom-aabb(RID, AABB).

1 Answer

+2 votes

Indeed, the function is missing from the nodes API. This function has to be exposed in GeometryInstance but so far only exists in the server API, so it's fine if you use that directly instead of nodes but that's quite impractical for more common use.

I posted an issue:

by (29,360 points)

Thanks! I'm glad to know this is being tracked down.

Back to the 1st question, is there some back-door trick (via server or whatever) to get RID for my MultiMeshInstance? I tried RID(obj) but that seems to work only for resources. This led me to think that I am having a conceptual misunderstanding and that RIDs only exist for resources. But then your server method made me think that, yes, they exist for nodes too, even if I can't figure out how to get one. Is that correct?

Btw, I also tried using MultiMesh RID in your VisualServer.instance-set-custom-aabb(), but that gave me "!instance" errors.

RIDs really exist for some nodes that are actually high-level wrappers around VisualServer objects (that includes resources, but not only).

Using on MultiMesh won't give the expected result because it's not a GeometryInstance. Here is how I used it in my project: (look at what _mesh_instance actually is)

But again it's not easy for common usage so it's just better to have that on nodes too rather than trying to get RIDs to bypass that lack (also I checked Godot 2.1.5, get_rid did not exist for nodes either).

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.