+1 vote

I'm using an Area2D in combination with a collisionShape2D to create an area in my platformer that triggers interactions (e.g. text bubbels).

I don't want to duplicate it each time so I included this in a scene. The problem is that the collision shape is not the root node of that scene and therefore I cannot change it from the scene where this is linked



Is there a way to change the collisionShape2D for each instance of scene A from scene B? I can select editable children but this changes that shape for each instance of sceneA in the same way.

in Engine by (19 points)

What is driving the need to change the collision shape and who/what has access to that information?

@jgodfrey For each trigger I would like to have a different collision box. In some places that means a small square while in other locations this means a large rectangle.

It would look like this:

--SceneA-instance1 -> small square collision box
--SceneA-instance2 -> large rectangle collision box
--SceneA-instance3 -> circular collision box

1 Answer

0 votes

For now I use a the following sequence to achieve the desired effect

  • Link the scene
  • Right-click on the scene and select 'editable children'
  • Click on the collision object which is now visible
  • In the inspector, click on the shape drowndown and select make unique

The workflow is a bit long but it does the job. You can now modify the collision box separate from other instances of this scene.

by (19 points)

Ideally, the scene itself would have enough information to modify its own collision shape when it's instantiated (though, you really haven't said what drives that decision). Anyway, if that were the case, when the scene is instantiated, it would simply adjust its own collision box as necessary.

Indeed I also thought about this. I could have used an export with the coordinates. However, I'm using it mainly in the editor to manually do the level construction. Therefore I was specifically looking for a way where I could use drag and drop to modify the shape. As far as I could find there was no way I could do this with an export.

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 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 webmaster@godotengine.org with your username.