Does Defold Offer Any Sprite To Sprite Collision Detection?


#1

Hi,

Does Defold have sprite to sprite collision detection?
(or I have to implement myself?)

Was hoping for pixel-perfect collision detection of possibly rotated sprites…

Thanks!

J.


#2

We do not support pixel perfect collision detection, but you can get very far using either a combination of multiple built-in collision shapes or by using custom polygon shapes (use this tool to create them: https://www.defold.com/community/projects/58981/)


#3

Hi,

If I use a rectangle collision shape, will the rectangle collision shape change when sprite is rotated?
We are developing a simple top-down car racing game.
Collisions are between player’s car and other cars and obstacles.

Thanks!

J.


#4

You do not rotate sprites, you rotate GOs, which have sprites attached to them. Collision objects are able to rotate with their parent GO based on GO rotation or physics simulation which would also rotate sprites attached to GO or any GOs set as a child of the GO being modified with physics.

Have you read the manuals yet?


#5

As Pkeod says, it’s the game object that you rotate, and when a game object is rotated, moved or scaled it affects the attached components, as well as child game objects. So yes, the collision component will rotate with the game object and so will the sprite.