Hello my dear Byond friends, I have an urgent request for help.
I'm curious if it's possible to create collision detection with pixels in icons.
http://imageshack.com/a/img922/9240/34jK3t.png
http://imageshack.com/a/img921/1379/9yzNMU.png
catch my drift?
![]() Apr 4 2020, 10:17 am
|
|
Are you looking for per-pixel collision, or just general hitboxes?
|
First of all thanks for replying, I suppose a per pixel kind of thing? If just one pixel touches the other character's pixels it counts as a hit.
|
It's possible, but a waste of grunt processing power. You are better off using AABB hitsweeps.
|
Ter13 wrote:
It's possible, but a waste of grunt processing power. You are better off using AABB hitsweeps. Oh could you please elaborate? |
I suppose it's important to note that the idea wouldn't be that the pixel collision would be active constantly for all objects, but rather for a weapon object that spawns when you attack and it checks if the pixels of the weapons touches the pixels of enemy mobs.
|
You are better off not doing that. It's a waste of grunt processing power for no real benefit. You are better off creating Axis-Aligned Bounding Boxes (AABBs) to perform hit testing than using pixels.
If you already understand how you are going to tackle pixel hit testing, you can easily understand how to do it with AABBs. It's just not worth how much processing power it's going to take versus a solver that uses stored hitbox information to grab opponents. So again, to answer your question. Yes, it's possible. But no, it's a waste of your time/resources. |
Here's a good article on it. Though Javascript is used in the article, the concept is well explained, so you should be able to write some equivalent code in DM.
https://developer.mozilla.org/en-US/docs/Games/Techniques/ 3D_collision_detection |