0
votes

I'm working on a "Words in a pic" clone and I have different images representing each letters and empty boxes where the letters should be put in to.

When I drag the letters I want them to be dragged like when it is a static body i.e. just up, down, left and right (no turning or spinning) and when the item is within the box it should stay within that box, otherwise it should go back to it's original position.

The thing is that static objects can't collide with another static object nor can a kinematic object collide with another object so I need to use Dynamic if I have understood it correctly?

However how do I do so when the drag event is activated the body, the letter image, moves like a static or kinematic body (only up, down, left and right) but also detects collision between a letter image and a empty box image?

Thanks for helping me with this, I have not been able to find any information on how to solve this problem!

1
Which physic engine do you use? - Leri
I use the Box2d engine - Westerlund.io

1 Answers

1
votes

This was easier than I though, you set the items as "dynamic" and then object.isSensor = true, to make it not rotate object.isFixedRotation = true and also deactivate the gravity through object.gravityScale = 0