You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers. No questions about C++ programming or topics which are answered in the tutorials!
Hello I'm trying to implement a dynamic triangle selector for hiding sunflare when it is covered by another object. That's why i tried to cast a ray between camera and sun and check if sth is between them in my update method. But I have a problm with triangle selector... What and haw shall I choose object from scene in update loop? I did this but probably because of nullpointer it crashess the app:
I ment lens flare... I thought it's obvious I just want to manipulate with its visibility when sun is behind something. The flare has same position as sun cause sun is a parent node for lens flare in my project.
I'm making a space game and I'll probably have solar flares, so I was just checking.
At a glance, couldn't you check the result of getCollisionPoint() directly? It returns a boolean value of if it there was a collision or not.
So what you want is to display the flare when sun isn't behind something? It becomes problematic fairly quickly, because I'd imagine the collision detection would be pretty expensive. Also, what if half of the sun is showing? Do you want the lens flare to appear with half transparency?
I'm not quite sure what other approaches you could use. I'll try to think of some and get back to you.
Well as we all know it is fixed in many games somehow That is why I was asking if there's a better solution for that... Speaking about those cases when f.ex half of sun is visible... The best way would be to throw the lens flare idea away and implement godrays Bt that would be probably hard using Irrlicht Explaining if sun is visible or not by picking its center would be fine solution for me... I know that this may be an expensive solution but can't find any better right now :/
EDIT:
Anyway I started to search where the app crashes with my solution and it is here:
Well that's hard to say, but I have a lot of nodes of this type in the scene. Is there any better way of selecting them than this one? Having an array and catching only the first one may be not a good idea but I don't know how to check the whole scene with all of its nodes by the selector...
It crashes even when I try to get scene node from id... Is there any way to use getCollisionPoint() method without defining triangle selector for specified node but for whole scene? That would fix the problem...
@entity: It'll be slow 'coz it'll just cycle through all of the selectors and check their BB (best case: checks only their BB) one by one. But yeah it's the easiest way!