martyj Posted October 10, 2017 Share Posted October 10, 2017 Here is the list of entities in my worldhttps://imgur.com/a/tPRa6 When I run the following code in Lua, it returns NULL local world = World:GetCurrent() CaveIn2_ATrappedMiner.boundingBox = world:FindEntity("EndAsdfgwg") if CaveIn2_ATrappedMiner.boundingBox == nil then System:Print("Null bounding box") return end When I run the following code it returns the Entity as expected CaveIn2_ATrappedMiner.rubble = world:FindEntity("Rubble") When I loop through all the entities and print their name, EndAsdfgwg isn't listed in the World Any ideas as to what I am doing wrong? Quote Link to comment Share on other sites More sharing options...
gamecreator Posted October 10, 2017 Share Posted October 10, 2017 What does world->CountEntities() return? Quote Link to comment Share on other sites More sharing options...
martyj Posted October 11, 2017 Author Share Posted October 11, 2017 2 hours ago, gamecreator said: What does world->CountEntities() return? This returns 414 Quote Link to comment Share on other sites More sharing options...
gamecreator Posted October 11, 2017 Share Posted October 11, 2017 Oh, you create other things...? I wonder if it returns the same number if you remove that one entity. But this is mostly just curiosity at this point. Quote Link to comment Share on other sites More sharing options...
martyj Posted October 11, 2017 Author Share Posted October 11, 2017 After deleting that entity it drops the count to 413. I wonder if the name isn't setting correctly. Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted October 11, 2017 Share Posted October 11, 2017 Anything special about this entity? CSG brush, camera, model? Reminder: CSG brushes are collapsed if they don't have a script or mass. Makes finding the entity impossible if that hasn't happened. Quote Link to comment Share on other sites More sharing options...
macklebee Posted October 11, 2017 Share Posted October 11, 2017 App:FindEntity("EndAsdfgwg") why are you doing App:FindEntity()? shouldn't it be 'world:FindEntity()' since you went to the trouble of finding the current world and thats the title of your topic? And are you for some reason still using the very depreciated app.lua scripting? Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
martyj Posted October 11, 2017 Author Share Posted October 11, 2017 7 hours ago, AggrorJorn said: Anything special about this entity? CSG brush, camera, model? Reminder: CSG brushes are collapsed if they don't have a script or mass. Makes finding the entity impossible if that hasn't happened. The entity that cannot be found is a Box. The entity that can b e found is a Pivot 4 hours ago, macklebee said: App:FindEntity("EndAsdfgwg") why are you doing App:FindEntity()? shouldn't it be 'world:FindEntity()' since you went to the trouble of finding the current world and thats the title of your topic? And are you for some reason still using the very depreciated app.lua scripting? I've updated my sample to reflect the topic. I wrote my own FindEntity function to try to see if there is a bug in the World's FindEntity. It just loops through the world entities calling World::GetEntity(n) and compares the name. Both my version and the LE version have the same problem, I'd imagine they are along the same lines of code. Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted October 11, 2017 Share Posted October 11, 2017 10 minutes ago, martyj said: The entity that cannot be found is a Box. Since the entity count changes, it might not be the issue, but have you tried attaching an empty lua script? Quote Link to comment Share on other sites More sharing options...
macklebee Posted October 12, 2017 Share Posted October 12, 2017 10 hours ago, martyj said: The entity that cannot be found is a Box. The entity that can b e found is a Pivot I've updated my sample to reflect the topic. I wrote my own FindEntity function to try to see if there is a bug in the World's FindEntity. It just loops through the world entities calling World::GetEntity(n) and compares the name. Both my version and the LE version have the same problem, I'd imagine they are along the same lines of code. good to know - without that info about your own function it makes people guess at the problem. when you say the entity that cannot be found is a Box are you referring to a CSG created box or an actual model that has been imported? Because like Aggror has asked/implied about twice now: if that entity is a CSG created box that you made in the LE world editor and you do not have the mass set greater than 0 or a lua script attached, then that CSG brush will be collapsed into one object with all the other mass-less, script-less CSG objects in the world which would prevent you from finding it via the "name" key. If for some reason this is an imported model or you have set mass or script to a CSG created box, then I would suggest posting an example map and sample code so others can try to replicate the issue. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
martyj Posted October 13, 2017 Author Share Posted October 13, 2017 It is a CSG Box. Good to know this is why I cannot find it. 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.