#(Beginner) Ground x player collision issues

1 messages · Page 1 of 1 (latest)

mental leaf
#

im making a 2d platformer game, but as of right now, the player floats above the ground, although the collision shapes are set correctly (see video).
thanks for anyone willing to help <3

severe turret
#

so it auto plays

mental leaf
#

had to get it low quality for it to upload to discord

zealous pine
mental leaf
#

yeah it is the problem actually

#

the player's collision box is way bigger than it should be

#

why is that though? note that i am changing the shape's size in the script to fit the animation.

#

I am changing it like this, is this wrong?

zealous pine
mental leaf
#

it's a regular RectangleShape2D. I am using shape.extends because this is what ChatGPT told me, the regular Scale property in Transform did not work for the collision box.

zealous pine
#

i'm surprised it doesn't crash

#

RectangleShape only has a size and is always centered on the CollisionShape node.

mental leaf
#

A property called collision.size ? I can't find one named that. By the way, thanks a lot for being able to help me.

zealous pine
#

the shape has a size relative to the position of the CollisionShape2D-node

mental leaf
#

I'm a little confused here. what property do I change?

zealous pine
#

an alternative solution to your problem might be to not actually change the size of the collision shape during the animation, but instead change the active one. a Physics Body can have multiple collisionshapes at once, and you can use the disabled-property to change which one is currently active.

mental leaf
#

yeah but I have about 6 different animations and it's going to be painful to do all that, but if anything won't work I will do it.