|
|
|
|
Attention |
Topic was automatically imported from the old Question2Answer platform. |
|
Asked By |
CrumbThief |
I’m having an issue with the position of a CollisionPolygon2D
generated with Create CollisionPolygon2D Sibling
where the origin [0, 0]
isn’t actually centred on the sprite itself.
I need to flip the CollisionPolygon2D
to align with the animation as it’s animated, but because the transformation doesn’t occur centred it throws the CollsionPolygon2D
flipped around the incorrect origin, causing it to be wildly out of place.
However when I move it manually to be centred on the Sprite
, it accounts for that x, y
translation and also ends up being wildly inaccurate.
Is there:
a) a way to reset the origin of a CollisionPolygon2D
?
or
b) a way to generate collision shapes and align those with a sprite sheet?
|
|
|
|
Reply From: |
Jorge |
Hi,
are you setting up the values on the main scene of instanced ?
try in the main scene of the player set the x,y in 0,0 add the collision shape at 0,0 and create the collision polygon there, should be not problem after that.
good luck
Sorry, I’m not sure I understand your question.
Here’s the scene tree:
The x, y
on the main scene is set to 0
, as well as the collision shape. The collision shape is generated by Godot.
Thanks for your reply!
CrumbThief | 2020-07-08 21:45
Hi,
the question is :
Do you have the player create in a separate scene? and then instanced on the Level scene?
you need to check this values on the player scene and don’t edit any values of the player on the Level scene.
and if the player is on the level scene you didn’t created its values and unique… you should not change the values there.
Set everything to x = 0, y = 0
I hope it makes sense.
good luck