adjust collision shape 2d according to animation frame?

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

Hey all, I’m working on a 2d bit art skateboard game. I’m new to Godot, and new to coding all together so this is a brutal adventure to say the least, and I’m tremendously grateful to have access to this community of helpful people.

Anyways, I hit another snag now. I’ve figured it out conceptually, but I’m unsure how to execute it in code. Basically, I need to adjust the Y coordinate of my collision shape to follow the board as it goes up in the air. The frame for the animation is much larger than the actual sprite (the board) because it needs to accommodate for significant vertical shift. So, I’m thinking I can manually set the collision shape frame-by-frame. Does that seem feasible?

Any insight is greatly appreciate. I’d post GIFs, but for some reason my images are coming out broken every time. Here’s a link to an animation so you can get an idea.

Hi, isn’t the collision shape son of the board? If so, height should update with the update of the board by itself. Unless the animation makes the board jump, but there is no actual y change for the board in the game (don’t know if im making myself clear). What i would do, is that the animation does not change the y coordinate, just flip in place. And then i’ll change the y coordinate of the board programatically. I don’ know if this is a good option in your case though

p7f | 2018-12-17 23:01

Yes, you are correct. The animation is jumping, but the character does not jump, so the y coordinate remains the same.

Your solution sounds perfect for me though! Would I use an animation start signal to trigger flip_v on the rigid body?

ZachMoldof | 2018-12-18 16:35