Godot Version
Godot 4.5
Question
I have a player dashes toward the mouse on click. I have set up a squash and stretch effect that
squashes the player relative to the direction of travel. So I’m rotating the character body and resizing it in an animation. I’m doing this as I don’t want the sprite to rotate so I’ve made the
sprite rotation equal to minus the character body rotation. The problem is when resizing the character body, it resizes the collision shape too. This makes it so that it will occasionally clip into walls. Is there some sort of way I can clamp the size of the collision shape to make it so that it works more consistently?
What’s the purpose of resizing the character body if you don’t want its transform to be propagated to neither sprite or colliders?
I want the sprite to get resized but I don’t want it to rotate. The player dashes at angles and I want the sprite to get resized along those angles. I don’t want the collider to get resized though.
Then only do things to sprite. Don’t rotate or resize the character body itself.
I want the sprite to get resized at different angles, so if I dash diagonally the sprite will get resized along the angles. The only way so far I could figure out how to do this is to rotate and resize the character body instead. If there were a different way to change the angle of the axis that something gets scaled I’d use it.
Then how would I change the size of the sprite along a different axis?
You can always insert an additional Node2D between the body and the sprite and do any proxy transforms there instead directly on body. This will leave the collider intact.
But if you insist on transforming the body you can do the same thing you’re doing with the sprite - reverse transform the collider. Reverse of scale is 1/scale
1 Like
Ok this probably works. Thank you!