Move my collision with my polygone

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

func mouvement_bras():

bras.look_at(get_global_mouse_position())
get_node("collision_main").position = Vector2(main.position)

What’s your question here? What are you trying to do? What are the node types of bras, collision_main and mainrespectively?

njamster | 2020-08-05 21:41

All right so i, i create a rig

bras = Arm Bone
collision_main = collision2d of a the hand
main = hand polygone


I want to move my hand collision with my hand polygone.

AllanOnAir | 2020-08-05 22:08

How does your scene tree look like? If the CollisionShape2D is a child-node of the Polygon2D, then moving the latter should also move the former - no code required!

njamster | 2020-08-06 10:50

Yes, but Collision2d can’t be child of 2d polygone

AllanOnAir | 2020-08-06 16:42

:bust_in_silhouette: Reply From: njamster

You can add a RemoteTransform2D-node as a child of the Polygon2D and set the CollisionShape2D that you want to move as its “Remote Path” in the editor. This way the CollisionShape2D can remain a child of the Player’s KinematicBody2D, but will be moved and rotated along with the hand polygon.

The collision does’nt move

AllanOnAir | 2020-08-08 22:33

Then you might want to provide an example project. It certainly works for me. And with the amount of detail you provided there’s nothing more I can do for you.

njamster | 2020-08-08 22:38

AllanOnAir | 2020-08-08 22:47

AllanOnAir | 2020-08-08 22:48

You have to set the “Remote Path” to “collision_main” not “main”.

njamster | 2020-08-08 22:57

AllanOnAir | 2020-08-08 23:00

AllanOnAir | 2020-08-08 23:01

It work in the editor but not In the game.

AllanOnAir | 2020-08-08 23:02

How have you determined that it doesn’t work? In the only in-game-screenshot you’ve provided, one cannot even see the CollisionShapes. Make sure to toggle Debug > Visible Collision Shapes before running the game! Are they in the right place? Do they move with the hand? Which parts are working and which are not?

njamster | 2020-08-09 19:30

Everything is working but the collision is not moving as you ca see in the gameplay screenshot where i’m supoosed to fall but my collision support me.

AllanOnAir | 2020-08-09 19:36

Look: If I could see that from the screenshot I wouldn’t have asked. In general: it’s not possible to see if something is falling or not by looking at just one screenshot…

This is a waste of my time, sorry. I told you what I know.

njamster | 2020-08-09 19:48