CollisionShape2D does not follow UI

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Mejro

I’m a beginner in Godot, and I have a problem.
I do not know about. I need your help.
I created the joystick for the android game. Actually MultiTouch.

Scene Scheme:
• Canvas Layer







The problem is that when player are moving, CollisionShape2D does not move along with Circles + (player + camera), but they stay in place.

How do we make CollisionShape2D move along with joysticks (circles) and player?

Please help me.

What exactly is it you are moving…???
If not Area2D_* then the CollisionShapes are not children of the right parent nodes…

Zappo_II | 2018-11-25 00:41

Here is a video about what does it do and what it should do

I know what you mean, but I have CanvasLayer as the main node.
He, as I know, should have all his children attached to the screen
On the video you can see that the circles work with the canvas layer correctly. But CollisionShape2D remain in their position towards the world, not toward CanvasLayer

And since Circles remain in position toward Canvas Layer So I think Area2D too

And I need to know how to fix it or do it

Mejro | 2018-11-25 08:51

Honestly, I don’t get (even by repeatedly watching the video) what is working as intended and what is not, but that doesn’t matter anyways…

I’ll try to state the obvious, just to make sure the general concept is made clear…

Usually one won’t want to move a collision shape, but one would want to move a collisionshape’s parent…(which should be of an appropriate node type to be moved)…which may or may not lead to a collision that can be detected from both sides, the moving object’s perspective and the collider’s perspective…

I have no idea, at this point of time, what it is you want to move or collide with in the first place…

Maybe it would be more helpful if you would provide the relevant parts of your code so one could inspect what you are trying to do…

Zappo_II | 2018-11-25 10:39

Maybe there is no problem in CollisionShape2D… Maybe in my code…

Area 2DR is right area for player rotation
and Area 2DL is left area for player movement <<< Screen

The player simply moves away from these two areas for touch

I’m sorry… I don’t quite understand myself to explain it…

Mejro | 2018-11-25 10:41

:bust_in_silhouette: Reply From: eons

You are probably facing this issue

Which should be solved by 3.1

A workaround for that may be placing the Area nodes on the main layer and attach these with RemoteTransform nodes or by code to move these when the visual representation on the CanvasLayer moves.

Kind of messy but the other option is to wait for 3.1

Well, it seems that 3.0.7 may include the fix too
Backport CanvasLayer fixes by RandomShaper · Pull Request #21271 · godotengine/godot · GitHub

eons | 2018-11-25 17:17