Digiverse Posted April 25, 2012 Share Posted April 25, 2012 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! Quote Link to comment Share on other sites More sharing options...
DigitalHax Posted April 26, 2012 Share Posted April 26, 2012 You could set the material to something transparent. Quote Win7 64bit, Leadwerks SDK 2.5, Visual Studio 2012, 3DWS, 3ds Max, Photoshop CS5. Life is too short to remove USB safely. Link to comment Share on other sites More sharing options...
Road Kill Kenny Posted April 26, 2012 Share Posted April 26, 2012 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. Quote 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 More sharing options...
Flexman Posted April 26, 2012 Share Posted April 26, 2012 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. Quote 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 More sharing options...
Digiverse Posted April 26, 2012 Author Share Posted April 26, 2012 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.