Jump to content

Entity Visibility


Digiverse
 Share

Recommended Posts

Hi,

 

How can I make an entity temporarily invisible, but still active in the physical world?

 

The HideEntity function makes an object disappear, but also stops its physics processing.

 

All I want to do is to be able to make an Entity invisble or visible at will, without interferring with its physics or collision tests.

 

The best solution I've come up with is to make the worlds near view range zero and when I want to hide an object set its view range to Near and back to Medium again when I want to show it. That works quite well but objects still appear when very close to the camera (even with camera near range at 0.1).

 

I feel there must be a simpler and more effective way of removing an entity from the rendering process?

 

Thanks!

Link to comment
Share on other sites

You could possibly use HideEntity() on just the mesh instead of the whole model. I'm pretty sure this would leave the physics box alone and allow it to continue doing its thing. However, I've never had the need to do that so I haven't tested it out.

 

You'll need to use FindChild("mesh"); to get just the mesh.

 

You could set the material to something transparent.

 

This is also possible. However, alpha = more processing = slower.

STS - Scarlet Thread Studios

AKA: Engineer Ken

 

Fact: Game Development is hard... very bloody hard.. If you are not prepared to accept that.. Please give up now!

Link to comment
Share on other sites

Yeah you can probably get away with hiding the mesh but if that doesn't work there's a material "invisible.mat" (and also a frag shader which discards all pixels). Set the object to use this and that will have the desired effect.

6600 2.4G / GTX 460 280.26 / 4GB Windows 7

Author: GROME Terrain Modeling for Unity, UDK, Ogre3D from PackT

Tricubic Studios Ltd. ~ Combat Helo

Link to comment
Share on other sites

Thanks for the suggestions, they were very helpful.

Hiding each child mesh belonging to the entity seems to work well and doesn't affect the physics processing as required.

 

I've now created an EntityVisible( TEntity, bool ) function for making objects invisible or visible.

In the function I loop through the child entites and for every mesh found using GetEntityKey( child, "class" ), I call HideEntity or ShowEntity on the mesh.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...