How do I sub-reference a physics object's LightControl's light?

I hope that made sense! :slight_smile: Ok, backstory: so basically have a spatial that is a rock with a LightControl added to it. I am using a LightControl because I already have an AmbientLight attached to this rock (you can’t attached more than 1 light to a spatial?). The LightControl’s light is attached to the rootnode, but the LightControl itself is attached to the spatial so that it will move where the spatial moves.

My problem: when my in-game character destroys one of these rocks, I am removing the rock from the physics space and removing it from the rootnode, however… even though I remove the LightControl, it’s light is still attached to the rootnode.

In my physics collision listener, I’m getting the rock spatial object through “event.getNodeA()” as you would expect… but what I haven’t been able to figure out is how to reference the light that the LightControl is parenting. I can get to the LightControl’s reference with “event.getNodeA().getControl(1)” but that doesn’t return as a LightControl, only as a Control, so the accessible properties and methods aren’t of a LightControl.

FYI… my constructor for the rock and its LightControl are global and I instantiate a new object from that, each time, within the function call for generating a new rock/light.

Any thoughts?

Thank you! :slight_smile:

Cast it to a light control: (LightControl)

or use the getControl() method that takes a class and returns that type.

Either way, spending some time learning Java would be really beneficial to working past these basic Java/OOP issues. Game writing is hard enough without struggling with basic language constructs.

Removed

Removed

Wow, what an arse you are sir.

Removed

Removed

@udoobu said: Glad I can reach out to my community and be made to feel like I'm not welcome to ask one question.

Get some fucking sleep @pspeed

Wow. I gave a helpful answer and added some advice because the answer is basic Java stuff. Someone who knew Java well would never have asked that question so it’s not an insult to point out that learning Java will be helpful. I think maybe you are the one who needs some sleep.

Removed

@udoobu said: @pspeed Riiiiiight...

I see you’re still awake… very disappointing.

Riiiight… and you know Java well but have somehow never managed to cast anything before. Nice trolling.