Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (577)
games submitted by our members
Games in WIP (498)
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  
  box2dlights - how would you detect if a body is being touched by light?  (Read 1043 times)
0 Members and 1 Guest are viewing this topic.
Offline heisenbergman

JGO Coder


Medals: 14
Projects: 1


L___ o_ G___ a__ P___


« Posted 2013-06-05 16:31:13 »

I don't really need it for anything right now, but I'd imagine it could be useful for something.

It just occurred to me when I was playing around with it... would it be possible to detect if a body is being touched by the light from box2dlights?

I initially thought it might be easy by getting the distance of the rays of light and seeing if a Body X is within that amount of distance from the source of the light... but what if there's another body in between Body X and the light source that is blocking the light source/preventing the rays from touching Body X?

Offline 65K
« Reply #1 - Posted 2013-06-05 18:47:15 »

I would guess that

RayHandler#pointAtLight()
RayHandler#pointAtShadow()

are for that task.

Offline heisenbergman

JGO Coder


Medals: 14
Projects: 1


L___ o_ G___ a__ P___


« Reply #2 - Posted 2013-06-06 09:29:18 »

^ Ah, those functions didn't immediately jump at me as made to be used for this purpose when I was skimming through the list of methods. Thanks.

I wonder how straightforward these would be to implement. I would guess that if a light source is hitting another body, the points being occupied by that body would return true for pointAtShadow even though its surrounding points would return true for pointAtLight. idk. Will explore this later.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Andre Lopes
« Reply #3 - Posted 2013-06-08 04:06:29 »

I would guess that

RayHandler#pointAtLight()
RayHandler#pointAtShadow()

are for that task.

Heya.
I pretend to use lights in my game, in the future.
Is there anything i should be aware of?
Like i need to use box2d physics or box2D??? ?
Also, all my tiles, walls, and my player needs to be extended or implements anything ?

Im using libgdx Cheesy


Offline heisenbergman

JGO Coder


Medals: 14
Projects: 1


L___ o_ G___ a__ P___


« Reply #4 - Posted 2013-06-08 05:49:35 »

Not sure what you're asking but the only other major I had with box2Dlights is discussed here:

box2dlights messing up the camera view

Offline Andre Lopes
« Reply #5 - Posted 2013-06-08 06:05:21 »

Not sure what you're asking but the only other major I had with box2Dlights is discussed here:

box2dlights messing up the camera view

oh , its ok, its because that later i might need to use it.
So im just wondering if i should code in a certain way, to make it easier to adapt it later.
Like, do i need use actors?( just an example)

Cheesy
Or maybe i can use libgdx native methods?
Offline heisenbergman

JGO Coder


Medals: 14
Projects: 1


L___ o_ G___ a__ P___


« Reply #6 - Posted 2013-06-08 06:13:21 »

You don't really have to code in a particular way. box2dlights is quite simple to integrate into the code once you understand how it works.

I can't say anything about actors since I don't use them though, sorry.

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (20 views)
2014-04-15 18:08:23

BurntPizza (16 views)
2014-04-15 03:46:01

UprightPath (29 views)
2014-04-14 17:39:50

UprightPath (14 views)
2014-04-14 17:35:47

Porlus (30 views)
2014-04-14 15:48:38

tom_mai78101 (55 views)
2014-04-10 04:04:31

BurntPizza (112 views)
2014-04-08 23:06:04

tom_mai78101 (212 views)
2014-04-05 13:34:39

trollwarrior1 (181 views)
2014-04-04 12:06:45

CJLetsGame (187 views)
2014-04-01 02:16:10
List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:05:20
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!