|
Of all things, this has me puzzeled. How do I simply just hide an object? It's not as simple as it sounds.. I need some way to hide an object that has dozens of root meshes inside it. I have looked into this code: But, it's not really set up right.. I don't know.. I keep getting a "InvalidCastException: Cannot cast from source type to destination type." error
(comments are locked)
|
|
This isn't really "hiding" objects, so maybe re-word your question-title for search-purposes if you will. Well, it sort of is the goal.. So, now I'm trying to select a parent object by assigning the variable in the inspector. var BodyVisual:Component[]; And then, this is how the code is: BodyVisual=gameObject.GetComponentsInChildren(Renderer); for(var joint:Renderer in BodyVisual){ joint.active = false ; } For some reason, this makes everything in my object with the script inactive. I want to select an object as a parent.. What should I do? Ps: sorry, I don't know how to put the "code" format in when I'm commenting.
Jan 27 '12 at 05:54 AM
Rush3fan
Also, this has nothing to do with joints of course..
Jan 27 '12 at 05:56 AM
Rush3fan
Ok.. so, you're wanting to disable the renderer "ONLY in the object this script is attached to" and NOT in the children?? Or what? I'm confused now. You wanted hingejoints, and are accessing children, but you really want a renderer and the parent?
Jan 27 '12 at 06:06 AM
Lo0NuhtiK
In this line: var BodyVisual:Component[]; I want to select just the car body mesh (which has many roots) with the inspector and hide the car body mesh. If I disable everything inside the car that the script is attached to, then you are disabling some imortant things besides along with the car body, wich is not what I want. I hope that make more sense..
Jan 27 '12 at 06:17 AM
Rush3fan
Why do you have them all stacked crazy like that? Is there a method in the madness? ... If not, you could make all those things "children" of Body_Visual, and hit'em all at once. I don't know how to go through 500 generations of objects in one shot, and don't feel like figuring it out at the moment either lol and be done with it. EDIT :NOTE : That image and the info that you're wanting to disable the renderers should have been what you originally posted in your question, not stuff about disabling springs in hingejoints and InvalidCast errors.
Jan 27 '12 at 07:39 AM
Lo0NuhtiK
(comments are locked)
|
