Cannot access to position of kinematic object shape

Hi.

My “player” game object consist from Sprite and CollisionObject. Collision object is a box which left aligh in sprite. When i do sprite.set_hflip("#sprite", true) Sprite flipped but CollisionObject no and palce in old position. I try to “with hands” fix position of CollisionObject but get_position() return postion of “player” go. How i may access to CollisionObject:BoxShape ? Is present more right way to fix CollisionObject? Sorry for bad english (

Tnx.

Hi!

As you experienced, sprite.set_hflip will only flip the sprite component in the GameObject. There are no functionality to flip, or set the position, at runtime of CollisionObjects.

Could you describe what you want to accomplish, maybe we could figure out a workaround? :slight_smile: I think @Andreas_Jirenius ran into similar problems with flipping spine components, maybe he has some pointers?

But what to do if collision object no full cover animated sprite? Look at screen http://prntscr.com/cw6dkd . I want catch ingredients with coven, coven is only part of player sprite … if player hflipped - collision appear in wrong place. Maybe i dont undestand part of defold flow? Thx.

1 Like

I see, let’s solve this! :slight_smile:

One alternative could be to have a separate GameObject where the CollisionObject resides. Then set this new GO as a child to the monster GO.

Then you should be able to set the position of this new “mouth” GO at runtime, while flipping the sprite in the monster GO. Similar to how you initially tried with the collisionobject, but instead setting the position for the mouth GO. :slight_smile:

1 Like

Oh, decomposition! This is usefull ! Thx for the support :slight_smile:

1 Like