Problems with collisions

2 gameobjects, with a sprite and a box collision object, I create a bigger box than the sprite for testing, the gameobject A goes to B, but dont get a message until they are into the other. Then I try putting the box , above the sprite, same behaviour,(the normal would be, not collision)
whats happening?

edit: the problem is that the box collider has diferent size in editor and in runtime…

how can I use the collision shape of the tilesource of the sprite?

Yes there is a discrepancy between editor and runtime if you don’t scale uniformly. The runtime only does uniform scaling (using the smallest of x, y, z scale) while editor shows non-uniform scaling. We are bringing this issue into our next sprint (starting on Monday) to make sure that the editor shows the same as the engine.

A tilesource doesn’t have a collision shape. Tilemaps does however trace collision shapes based on the actual pixel data. If you want collisions for a sprite when using a tilesource you need to add a collision component and some shapes that roughly covers the pixels of the sprite.

2 Likes

then what is the property collision for?

Oh, crap sorry, I’m confused. Assign the same image as the tilesource and it will be used as collision shape.

Next step is to add a collision object to your game object and use the tilesource as shape.

thats the point, when Im adding the collision object, in the property collision shape, only accept a tilemap, not the tilesource (for exameple , the previous spritesheet, with the collisions)…

It works like this:

Tilesource

  • This is a resource consisting of multiple images of the same size, laid out in a grid.
    • You can create animations, playing a range of images from the tilesource in sequence
    • You can create collision groups and “paint” tiles in the tilesource to belong to a group
  • A tilesource can be used as the input for a sprite, particlefx or a tilemap.

Tilemap

  • A tilemap needs a tilesource as input. Paint your tiles from the tilesource into one or more layers.
  • You can use a tilemap as a collision shape. This is typically how you deal with collisions for a level created using a tilemap

Sprite

  • A sprite needs either an atlas or a tilesource as input.
  • You can NOT use the tilesource as a collision shape. If you want to define a collision shape for a sprite you do this by adding a collision component and box and sphere shapes.
7 Likes

ok, its clear now, thank you very much as always.

1 Like