Pixel Collision with Rotated Sprites

Previous topic - Next topic

spicypixel

Seems an obvious one to me but having SPRITE and ANIM COLL that works on the ROTATED sprite would be cool rather than based on the original sprite.
http://www.spicypixel.net | http://www.facebook.com/SpicyPixel.NET

Comps Owned - ZX.81, ZX.48K, ZX.128K+2, Vic20, C64, Atari-ST, A500.600.1200, PC, Apple Mini-Mac.

Ian Price

It was suggested years ago.

There are work arounds, although none as smooth or as elegant as a built in rotation collision commands.

In one game I did (Balloonacy for Wiz, GP2X and pc) I drew my roto'd sprite in real-time onto a virtual sprite and used that for collision checking. Worked really well, even on a GP2X. I wouldn't recommend this for lots of roto-collsions though.

The alternative is to pre-render all rotations (if possible) - either as a spritesheet or at the start of the code.
I came. I saw. I played.

spicypixel

Had already thought of pre-rendering as it's a technique I have used before sprite rotation was even quick enough on certain other languages :D However firstly don't like the memory overhead especially for a smooth rotation and secondly it should be in there. A real oversight to have roto commands and no roto related collision. Will have to continue making ball games lol.
http://www.spicypixel.net | http://www.facebook.com/SpicyPixel.NET

Comps Owned - ZX.81, ZX.48K, ZX.128K+2, Vic20, C64, Atari-ST, A500.600.1200, PC, Apple Mini-Mac.

Ian Price

If you don't like pre-rendering then the virtual screen in real-time is the only option right now.
I came. I saw. I played.

Slydog

#4
I've been noticing that a lot of commercial games don't use pixel-perfect collision detection.

It would be cool to have a new feature (or create a sprite library) that offers adding (multiple?) colliders to sprites.
The basic circular and rectangular colliders would probably be enough for most games.

For example, a typical car sprite, with a body and two wheels:  (total size is 128x64)
Code (glbasic) Select
car.AddCollider_Box(0,0,  128,32)   // Main body - top half of sprite
car.AddCollider_Circle(32,48, 16)   // Left Wheel, radius 16
car.AddCollider_Circle(96,48, 16)   // Right Wheel, radius 16


And then have these colliders scale and rotate with the sprite.
Should be much faster and simpler to implement than pixel perfect sprite scaling and rotations.

Just a 'dream' request of course! 
One day I may create my own 2D sprite library, but not any time soon!
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

Kitty Hello

a Sprite is just a bitmap in memory. With GETSPRITESIZE you have all information at hands.
So, you can write: SPRCOLL_box() and SPRCOLL_sphere() easily yourself.