Game Development Community

Get objects "on view

by Fabio Zambetta · in Technical Issues · 09/02/2007 (1:42 am) · 4 replies

Hi,

First, thanks for reading this post... My question is:

Q: Just like the onCollision function can be used to find out which object you (e.g. the player) collided with, is there an event handling function that gets fired when an object comes in front of you (i.e. into the player's perspective)?

I looked through shapeBase and sceneGraph but I couldn't find it.

I'm new to Torque (but I'm an experienced programmer... if that helps!)

Thanks and hope someone can tell me where to look...

GTW

#1
09/02/2007 (2:30 am)
Afrim's climbing resource might be a good example.

Look at Player::findContact in player.cc line 2806 and 2820ff.
#2
09/03/2007 (12:13 am)
Hi Stefan, thanks for the reply. I checked the code and I think the code checks for the object after the player has collided with it. I suppose, if I were to use this method, I'd have to perform the check every time the player moves and on a lot of objects... which certainly would have a performance hit. Maybe there's a more efficient way to do it, and I'll post this question in the graphics forum.

Thanks again for the input!

GTW
#3
09/03/2007 (2:56 am)
Fabio, here's more code for you to check :)

Get the Context sensitive crosshair/object interaction resource and look at GuiAdvancedCrossHairHud::onRender in guiAdvancedCrossHairHud.cc.

In the comments to this resource, Gavin Bunney pointed out a way to perform a range check (Apr 10, 2006).

Hope it helps.

Stefan

Btw I think the graphics forum is the wrong place to ask for help for this problem ;)
#4
09/05/2007 (6:21 pm)
Thanks Stefan! I'm checking it out now...

I kinda figured the graphics forum is the wrong place since no one replied... I thought it was relevant to rendering because of perspectives and objects in it.

Btw, I'm not Fabio... I'm his research assistant. We're working on a project together :)

GTW