Vulcan Posted July 25, 2014 Share Posted July 25, 2014 Hi! I recently encountered a problem when I tryied to get an entity based on its name. First I made a box in LE as "Box 1" in the scene list/graph. And I was trying to find the entity "Box 1" in C++ but for some reason it does not show up. I am not sure how to interact with this box otherwise. list<Entity*>::iterator iter; for (iter = world->entities.begin(); iter != world->entities.end();++iter) { fileLogger.Log("Entity: " + (*iter)->GetKeyValue("name")); } When looking through the log I don't find "Box 1" anywhere. ... [21:13:39] Entity: [21:13:39] Entity: [21:13:39] Entity: [21:13:39] Entity: cardboardbox [21:13:39] Entity: cardboardbox [21:13:39] Entity: cardboardbox [21:13:39] Entity: cardboardbox [21:13:39] Entity: cardboardbox [21:13:39] Entity: cardboardbox [21:13:39] Entity: cardboardbox [21:13:39] Entity: cardboardbox [21:13:39] Entity: cardboardbox [21:13:39] Entity: Directional Light 2 [21:13:40] Entity: [21:13:40] Entity: BarbarianLDigit110 [21:13:40] Entity: BarbarianLFoot [21:13:40] Entity: barbarian_knee_pad_L [21:13:40] Entity: BarbarianLCalf ... In LE scene graph there is "Directional Light 2", several "cardboardbox" and last "Box 1". Rest is loaded from C++. I don't know what to do, please help! Quote Link to comment Share on other sites More sharing options...
Rick Posted July 25, 2014 Share Posted July 25, 2014 CSG gets collapsed with all the other CSG and you can't pull it out if this happens. There are 2 ways to prevent this collapse from happening and allow you to access the CSG. 1) Give it a mass 2) Attach a Lua script to it. If you don't want it to have a mass just make an empty entity script and attach it to the CSG and then you should be able to access it via your code. Quote Link to comment Share on other sites More sharing options...
Vulcan Posted July 25, 2014 Author Share Posted July 25, 2014 CSG gets collapsed with all the other CSG and you can't pull it out if this happens. There are 2 ways to prevent this collapse from happening and allow you to access the CSG. 1) Give it a mass 2) Attach a Lua script to it. If you don't want it to have a mass just make an empty entity script and attach it to the CSG and then you should be able to access it via your code. Thank you! Adding mass did the trick. 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.