Hiding interiors and objects
by Bill Keller · in Torque Game Engine · 01/04/2004 (10:43 pm) · 11 replies
Hello all.
Is there any way to flag an object or interior to not render? I have a third person camera, and occasionally a wall or ceiling (interiors) will come in between the camera and the player. I would like to be able to hide the interior, as well as any objects that should be attached to the wall.
It seems like there ought to be a "visible" property on the scene objects, but I sure can't find it.
Thanks!
Bill
Is there any way to flag an object or interior to not render? I have a third person camera, and occasionally a wall or ceiling (interiors) will come in between the camera and the player. I would like to be able to hide the interior, as well as any objects that should be attached to the wall.
It seems like there ought to be a "visible" property on the scene objects, but I sure can't find it.
Thanks!
Bill
#2
Not really. You could break it up into multiple components, or maybe extend the DIF format to tag faces, then conditionally render them...
01/05/2004 (11:13 am)
Console methods inherit, so you won't need to redefine them.Not really. You could break it up into multiple components, or maybe extend the DIF format to tag faces, then conditionally render them...
#3
Hiding individual pieces of an interior would be harder. My only guess would be to use the BSP system and hide partitions individually, though, that could get very ugly.
01/05/2004 (11:54 am)
I'm pretty sure interiors inherit from either sceneobject or gamebase, not shapebase. Interiors don't have .dts's, so they have no "shape" - they are a seperate entity. So, yes, you would have to write the functions again or move them to a class higher up in the heirarchy.Hiding individual pieces of an interior would be harder. My only guess would be to use the BSP system and hide partitions individually, though, that could get very ugly.
#4
However, that can mess up the lightmap at times. For instance, if a light is on the wall of a room, it won't light the ceiling if the ceiling is a different interior. I can duplicate lights in the different interiors, so that the pieces are lighted equally, but I run into a problem with a pillar casting a shadow on the ceiling that doesn't show up when the ceiling is a separate interior.
Is there a way to only export a portion of a map? What would be ideal is take the entire map into account when generating the lightmap, but only generate a subset of the geometry. I'm using Hammer right now, but can switch to something else if it does what I need.
Thanks again!
01/05/2004 (12:27 pm)
Thanks for the replies. Looks like the easiest approach will be to build the interiors up in parts. However, that can mess up the lightmap at times. For instance, if a light is on the wall of a room, it won't light the ceiling if the ceiling is a different interior. I can duplicate lights in the different interiors, so that the pieces are lighted equally, but I run into a problem with a pillar casting a shadow on the ceiling that doesn't show up when the ceiling is a separate interior.
Is there a way to only export a portion of a map? What would be ideal is take the entire map into account when generating the lightmap, but only generate a subset of the geometry. I'm using Hammer right now, but can switch to something else if it does what I need.
Thanks again!
#5
01/05/2004 (2:09 pm)
Hobbs - he said SimObject had it, everything inherits from SimObject...
#6
Hopefully quotes work...
EDIT: Sweet! Except bold and stuff doesn't inside of quotes :(
01/06/2004 (5:36 pm)
Quote:
ShapeBase defines console functions for setHidden and isHidden which work perfectly. So it appears that all I need to do is add the console methods to the InteriorInstance class to do the same thing.
Hopefully quotes work...
EDIT: Sweet! Except bold and stuff doesn't inside of quotes :(
#7
Yeah, Hobbs is right. ;)
I would move the console method definitions up to apply to SimObjects, myself.
01/06/2004 (9:47 pm)
i r dumb.Yeah, Hobbs is right. ;)
I would move the console method definitions up to apply to SimObjects, myself.
#8
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=3605
01/08/2004 (5:07 am)
Perhaps this link will help:http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=3605
#9
In order to hide interiors I've followed the above instructions and moved the ConsoleMethod definitions for setHidden() and isHidden() up to the SimObject class. This works but, oddly enough, setHidden() only seems to take effect after the editor is opened and closed.
I thought the problem had something to do with ghosting (as I'm running the game in a LAN/singleplayer setup) so I tried packing/unpacking the status of the interior (mHidden) with no luck. I've also tried moving the ConsoleMethod definitions back down to ShapeBase and simply redefining them in InteriorInstance (along with the isHidden() and setHidden() functions) - still a no go.
ShapeBase::setHidden() has a comment about needing to set a mask bit (via setMaskBit(CloakMask)) in order for the ghost manager to delete copies of the object. This doesn't seem to effect the problem at all - whether I define CloakMask and activate it in InteriorInstance::setHidden() or not.
Any insight into why opening/closing the editor would cause interiors to show/hide properly would be greatly appreciated.
10/12/2004 (7:27 pm)
Sorry for bumping such an old thread but I'm dealing with a similar problem.In order to hide interiors I've followed the above instructions and moved the ConsoleMethod definitions for setHidden() and isHidden() up to the SimObject class. This works but, oddly enough, setHidden() only seems to take effect after the editor is opened and closed.
I thought the problem had something to do with ghosting (as I'm running the game in a LAN/singleplayer setup) so I tried packing/unpacking the status of the interior (mHidden) with no luck. I've also tried moving the ConsoleMethod definitions back down to ShapeBase and simply redefining them in InteriorInstance (along with the isHidden() and setHidden() functions) - still a no go.
ShapeBase::setHidden() has a comment about needing to set a mask bit (via setMaskBit(CloakMask)) in order for the ghost manager to delete copies of the object. This doesn't seem to effect the problem at all - whether I define CloakMask and activate it in InteriorInstance::setHidden() or not.
Any insight into why opening/closing the editor would cause interiors to show/hide properly would be greatly appreciated.
#10
- Brett
10/13/2004 (5:39 am)
Have you checked with the inspectPostApply() method? I would think that that is the reason why that happens. So, create a console function (as I did) that calls the method, then you can call that from script. Be sure to check to make sure that mIsHidden is attached to a state that will be retransmitted when the method is called.- Brett
#11
10/13/2004 (7:02 am)
Thanks for the reply Brett. I'll give your suggestion a try.
Torque Owner Bill Keller
SimObject has setHidden() and isHidden() functions. Interiors derive from that, and in InteriorInstance::renderObject, an isHidden() check is made, so presumably, interiors can be hidden.
ShapeBase defines console functions for setHidden and isHidden which work perfectly. So it appears that all I need to do is add the console methods to the InteriorInstance class to do the same thing.
Is there any way to clip just part of an interior? For instance, if I have a basic cube building (four walls and a ceiling) is there anyway to just render the walls?
Thanks!
Bill