Interactive news ticker

I am working on an interactive news ticker for my game. I got the main ticker running. This was the easy part. But now I need to detect when the player clicks on a news item.

The entire ticker runs straight on the guiNode. Also it is set up in such a way that it is easy to define different types of tickers. The main functionality is the same for all tickers, but the reation of ticker items and ticker item seperators is setup through abstract methods. This way, you can just extend the base Ticker and TickerItem class to define different types of tickers.

Now I need to figure out how to do the callback functionality when the player selects a news item. I can’t seem to figure out how to detect this though.

As far as I can tell, the guiNode and everything contained therein is a Spatial, and as such, I would expect it to be detectable by raycasting. But for some reason, the code I use to detect if a model on the rootNode is targetted, doesn’t detect a select on a guiNode child.



Does anyone have a working piece of code I can look at to see where I’m going wrong?

@ractoc said:
I am working on an interactive news ticker for my game. I got the main ticker running. This was the easy part. But now I need to detect when the player clicks on a news item.
The entire ticker runs straight on the guiNode. Also it is set up in such a way that it is easy to define different types of tickers. The main functionality is the same for all tickers, but the reation of ticker items and ticker item seperators is setup through abstract methods. This way, you can just extend the base Ticker and TickerItem class to define different types of tickers.
Now I need to figure out how to do the callback functionality when the player selects a news item. I can't seem to figure out how to detect this though.
As far as I can tell, the guiNode and everything contained therein is a Spatial, and as such, I would expect it to be detectable by raycasting. But for some reason, the code I use to detect if a model on the rootNode is targetted, doesn't detect a select on a guiNode child.

Does anyone have a working piece of code I can look at to see where I'm going wrong?


The code you posted looks fine to me.

In the guiNode, no special translation is needed for the pick vector... just take the X, Y of the mouse location and give it a Z (into the screen).
@pspeed said:
The code you posted looks fine to me.

In the guiNode, no special translation is needed for the pick vector... just take the X, Y of the mouse location and give it a Z (into the screen).


I actually mean, use the x,y as a starting location with a high Z and then use a direction vector with just -Z.

But without your code, we can't really tell what you've done wrong.

Thanks Paul, that was the hint I was looking for. The callbacks are now also in, I now have a fully functional ticker tape. Complete with callback on item select.