Rick Posted February 15, 2010 Share Posted February 15, 2010 I'm curious how other people determine if the terrain was picked vs other meshes. According to http://www.leadwerks.com/wiki/index.php?title=Raycasting#CameraPick the pick.surface will be null if it's not a mesh (ie. terrain). So I'm going off that, but is there a down side to that? Is this how we should tell if the terrain vs a mesh if being picked by the camera? Also, the way I had to tell that was by using strcmp() against pick.surface since a simple check against 0 (null) didn't work. It works and I get why it works since TEntity is just a char*, but it does seem strange when you read it in code. Is there another way that looks like it makes more sense? Seems like there should almost be a IsEntityNull() method or something in the engine. Quote Link to comment Share on other sites More sharing options...
macklebee Posted February 15, 2010 Share Posted February 15, 2010 check the class of the picked entity 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...
Rick Posted February 15, 2010 Author Share Posted February 15, 2010 What do you mean? I do wrap my mesh objects with user data of a class instance, but I don't for the terrain. I could check for null but wouldn't this basically mean I have to create a generic class that everything has SetEntityUserData in? Or are you talking a different kind of class? Quote Link to comment Share on other sites More sharing options...
macklebee Posted February 15, 2010 Share Posted February 15, 2010 These are the classes I am referring to:Entity Classes In bmax its GetEntityClass(TEntity)... in lua its entity:GetClass() 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...
Rick Posted February 15, 2010 Author Share Posted February 15, 2010 Is that undocumented? I don't see it on the wiki and doesn't seem to be in C++. What information does that return anyway? Like TCamera or TTerrain? Quote Link to comment Share on other sites More sharing options...
macklebee Posted February 15, 2010 Share Posted February 15, 2010 Its undocumented. There is an example of usage inside the fpscontroller lua script. 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...
Rick Posted February 15, 2010 Author Share Posted February 15, 2010 Oh, well that sucks. It doesn't seem to be in C++. The way I have it works for this instance, so I guess I'll just use this. Thanks! Quote Link to comment Share on other sites More sharing options...
TylerH Posted February 19, 2010 Share Posted February 19, 2010 GetEntityKey(entity,"class") should return "Mesh" or "Model" for a mesh type entity, and "Terrain" for terrain. Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
Rick Posted February 19, 2010 Author Share Posted February 19, 2010 Have you tried this? Because I don't get a "Terrain". Quote Link to comment Share on other sites More sharing options...
TylerH Posted February 19, 2010 Share Posted February 19, 2010 If it isn't class, it would have to be classname as the key. It works, I used it in Jeklynn Heights in C++ for the 3rd person camera collision. It would react differently to terrain and meshes, based on a check against the key. Not sure if something has changed regarding this between 2.30 and 2.31, so I guess I can say I haven't tried it "yet/now". Let me test... Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
Rick Posted February 19, 2010 Author Share Posted February 19, 2010 I tried classname also and that didn't work for me. 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.