GMS 2 top-down tilemap collison with rotated rectangles/collision mask

P

PandaPenguin

Guest
so I'm not sure how to describe this....

I know how to make a working tile collision with bounding boxes and 4-corner checks (typical platformer collision style)
this works all nice and fine since the "shapes" are all lined up in 90° angles and corners

but for my little testing project (to toy around in GMS2) I made this top-down "tank game"
the tank can rotate in any angle and is "driven" by direction and speed/friction
the "map" is built with auto-tiles to form some sort of arena


and here comes the tricky part...
since the tank can be rotated in any degree I have not yet found a suitable way to make tile-collision work


as you can see in this "debug" overlay, the green border is the total bounding box and the yellow rectangle is the collision mask I manually added (since chassis and treads are separate objects)

I can't do a collision check with the bounding box for obvious reasons shown in the image

the white area are actually solid objects I added with a loop to the position of every "occupied" auto-tile

those collision objects have the tile width/height and thus (as you can see in the lower right corner) they sum up to a total of over 800 of these collision objects.
now I know I can optimize the collision objects (lesser numbers, stretched, etc), that's not the question here, they are just how they are now for testing purpose

the tutorials I found were for non-rotated rectangular objects only (platformer style)
the only tutorial that I think got somehow close is the "pixel collision with tilemaps" tutorial... but the audio is so horrible I couldn't watch it

my question is if there is a better way of having angled tile collision than the old GMS1.4 way with solid collision objects (which, btw works just fine as intended)
 
they are planning to add tile collision functions, but a timeframe was not given yet.
so for now you'll need a workaround, but once those functions are here things should become a whole lot easier.
 
P

PandaPenguin

Guest
they are planning to add tile collision functions, but a timeframe was not given yet.
so for now you'll need a workaround, but once those functions are here things should become a whole lot easier.
ya I really hope for these functions to come... would make a lot of sense to have them
because...why having this awesome new and improved auto-tile feature when you can't "use" them in an easy coded way :D
 
Top