Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (741)
Games in Android Showcase (225)
games submitted by our members
Games in WIP (823)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Color Collision??  (Read 3754 times)
0 Members and 1 Guest are viewing this topic.
Offline VIrtueeL
« Posted 2014-12-25 19:09:54 »

i just got this idea in my mind hope you read it all


so lets say we have 2 cubes 1 red and 1 blue

now if we could check if red Color intersects with blue Color and if it does the color purple stop moving?

have anybody tried this?

it just came to my mind by random, the idea can be improved ofcorse but would that save performance or?

i do devlogs and i do tutorials check em out
https://www.youtube.com/user/InidDevo
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 167
Projects: 5
Exp: 6 years



« Reply #1 - Posted 2014-12-25 19:11:39 »

How would comparing rgb values be any different from comparing mass x velocity?
Offline VIrtueeL
« Reply #2 - Posted 2014-12-25 19:12:36 »

i dunno :/ just came to my mind out of absolutely no where

i do devlogs and i do tutorials check em out
https://www.youtube.com/user/InidDevo
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline MrPizzaCake

Senior Devvie


Medals: 8
Exp: 3 years


Hello, another wonderful human being :)


« Reply #3 - Posted 2014-12-25 19:15:36 »

Visual-based collision... Not really practical, but very interesting idea!

How am I? Tough question, since emotions are confusing as heck Tongue
Offline VIrtueeL
« Reply #4 - Posted 2014-12-25 19:17:41 »

for ex: if now this would work you could just add like 4 red pixels on the player that does not render and thats it!

i do devlogs and i do tutorials check em out
https://www.youtube.com/user/InidDevo
Offline Opiop
« Reply #5 - Posted 2014-12-26 02:49:27 »

Very inefficient. Do you ever wonder why you've never heard anyone talk about something like this? It's because people have tried it, and realized it's not as efficient as a math based approach.
Offline Ecumene

JGO Kernel


Medals: 195
Projects: 4
Exp: 8 years


I did not hit her! I did not!


« Reply #6 - Posted 2014-12-26 03:23:59 »

Very inefficient. Do you ever wonder why you've never heard anyone talk about something like this? It's because people have tried it, and realized it's not as efficient as a math based approach.

I'm sure it's still a good option in some case, just because you've never heard of it doesn't mean you should rule it out. I think OP should try it out.

Offline BurntPizza

« JGO Bitwise Duke »


Medals: 485
Exp: 7 years



« Reply #7 - Posted 2014-12-26 03:43:42 »

This is called collision masking among other names.
https://www.google.com/search?q=bitmask%20collision

Includes JGO post near the bottom  Pointing
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 167
Projects: 5
Exp: 6 years



« Reply #8 - Posted 2014-12-26 05:04:14 »

This is called collision masking among other names.
https://www.google.com/search?q=bitmask%20collision

Includes JGO post near the bottom  Pointing
Damn, JGO 2004 Tongue
Anyways, I assumed he was talking about box2d-like physics, maybe too quickly.
Offline BurntPizza

« JGO Bitwise Duke »


Medals: 485
Exp: 7 years



« Reply #9 - Posted 2014-12-26 05:07:38 »

I'm pretty sure the technique has existed since at least the 80s.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline KudoDEV

JGO Ninja


Medals: 79
Exp: 6 years


Game Dev Hobbyist


« Reply #10 - Posted 2014-12-26 05:09:44 »

Yeah using bitmasks for 2d collision is pretty old. It is also nothing worth looking into imho.

Offline Ecumene

JGO Kernel


Medals: 195
Projects: 4
Exp: 8 years


I did not hit her! I did not!


« Reply #11 - Posted 2014-12-26 06:25:05 »

Yeah using bitmasks for 2d collision is pretty old. It is also nothing worth looking into imho.

I disagree. He may not use it, but it it's still good to know. Wink

Offline VIrtueeL
« Reply #12 - Posted 2014-12-26 08:28:23 »

yeajh tbanks for the response!

i do devlogs and i do tutorials check em out
https://www.youtube.com/user/InidDevo
Offline pitbuller
« Reply #13 - Posted 2014-12-26 20:41:34 »

Pixel based collisions has used many times but they use bitmask not actual colors.
Offline Ecumene

JGO Kernel


Medals: 195
Projects: 4
Exp: 8 years


I did not hit her! I did not!


« Reply #14 - Posted 2014-12-26 20:44:07 »

Pixel based collisions has used many times but they use bitmask not actual colors.

You could use the colors as directional representation of where it should push the one colliding with it to, and it's alpha being the intesity. So you could do water as (0, 1, 0, 0.5) for up, and 0.5 being the intensity. If the alpha is 0, it could represent no collision.

Offline BurntPizza

« JGO Bitwise Duke »


Medals: 485
Exp: 7 years



« Reply #15 - Posted 2014-12-26 20:57:56 »

You could use the colors as directional representation of where it should push the one colliding with it to, and it's alpha being the intesity. So you could do water as (0, 1, 0, 0.5) for up, and 0.5 being the intensity. If the alpha is 0, it could represent no collision.

And that would roughly be (signed) distance fields, albeit over-complicated. They are interesting because they do have practical uses, from text-rendering to pathfinding to (less practically) collision detection.
Offline pitbuller
« Reply #16 - Posted 2014-12-27 11:15:16 »

Pixel based collisions has used many times but they use bitmask not actual colors.

You could use the colors as directional representation of where it should push the one colliding with it to, and it's alpha being the intesity. So you could do water as (0, 1, 0, 0.5) for up, and 0.5 being the intensity. If the alpha is 0, it could represent no collision.

Those are not colors anymore but arbitary data.
Pages: [1]
  ignore  |  Print  
 
 

 
xxMrPHDxx (18 views)
2017-11-21 16:21:00

xxMrPHDxx (11 views)
2017-11-21 16:14:31

xxMrPHDxx (14 views)
2017-11-21 16:10:57

Ecumene (114 views)
2017-09-30 02:57:34

theagentd (148 views)
2017-09-26 18:23:31

cybrmynd (248 views)
2017-08-02 12:28:51

cybrmynd (247 views)
2017-08-02 12:19:43

cybrmynd (244 views)
2017-08-02 12:18:09

Sralse (258 views)
2017-07-25 17:13:48

Archive (878 views)
2017-04-27 17:45:51
List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05

SF/X Libraries
by SkyAphid
2017-03-02 06:38:56

SF/X Libraries
by SkyAphid
2017-03-02 06:38:32

SF/X Libraries
by SkyAphid
2017-03-02 06:38:05

SF/X Libraries
by SkyAphid
2017-03-02 06:37:51
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!