Andy Gilbert Posted February 1, 2012 Share Posted February 1, 2012 Hi, im struggerling with getting the collision callback for a single entity and lua? Ive tried both ways, using the colision callback and also raycasting. Raycasting would be my preffered way as i would prefer to know if the entity is wihin a certain distance fromthe terrain directly below. How do i go about doing this? Thanks Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
Marleys Ghost Posted February 1, 2012 Share Posted February 1, 2012 Raycasting would be my preffered way as i would prefer to know if the entity is wihin a certain distance fromthe terrain directly below. How do i go about doing this? Perform a raycast? then measure? Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
Andy Gilbert Posted February 1, 2012 Author Share Posted February 1, 2012 lol, that would be simple if i new exactly how, but as stated in my first post, i cant seem to get it to work? (was looking for maybe an example) Thanks Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
Marleys Ghost Posted February 1, 2012 Share Posted February 1, 2012 Well you said you had tried both ways, post your code and maybe we can see where you are going wrong. Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
YouGroove Posted February 1, 2012 Share Posted February 1, 2012 Didn't you found some collision examples on WIKI or Documentation sub forum ? Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Andy Gilbert Posted February 1, 2012 Author Share Posted February 1, 2012 HI YouGroove, Ive had a look like i always do, but seing as the wiki doesnt even list the lua commands for ray casting (nevermind examples) its a bit of a guessing game. Hence im now here. Im a little confused about what you mean by the documentation sub forum, i cant find any lua collision or ray casting examples in the documentation, but i might just not being seeing it?? Thanks Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
macklebee Posted February 1, 2012 Share Posted February 1, 2012 the lua raycasting commands use the exact same syntax as the c/c++/bmax commands... i would assume the documentation sub forum is this: http://www.leadwerks...nce/raycasting/ 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...
Marleys Ghost Posted February 1, 2012 Share Posted February 1, 2012 Probably easier to post the code you currently have. Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
Andy Gilbert Posted February 2, 2012 Author Share Posted February 2, 2012 Ok. the problem i immidiatly came up against with raycasting in lua was finding the "terrain", i tryed using FindChild("terrain") but it doesnt find it? How can i return the terrain from a scene loaded ion, for use as an entity, for raycasting? Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
macklebee Posted February 2, 2012 Share Posted February 2, 2012 http://www.leadwerks...dpost__p__34892 or simply check the class of the picked entity... a simple line pick from your entity should work fine without needing to find the terrain... then measure the difference in height from the return picked position to your entity's position since you have tried various ways already, maybe you should just post an example of what you currently have so we can see what could be wrong? 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...
Andy Gilbert Posted February 2, 2012 Author Share Posted February 2, 2012 HI Macklebee, maybe im not understanding the pick commands correctly. Ive took out the code i tried (as it wasnt working) but ill give it another go then return with it if i dont have any luck. as i want to check the distance of between the entity and the terrain directly below, i thought a "linepick" is what i would want, but i was just returning an error. Ill try again. Cheers Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
Andy Gilbert Posted February 2, 2012 Author Share Posted February 2, 2012 Ok, ive give it a go and think i understand it now, but the issue now is that how to declare a "Tpick" in lua? Do i just use a table/array? Thanks Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
macklebee Posted February 2, 2012 Share Posted February 2, 2012 no need to declare... just do like you do with any other LE command in lua... a simple search for line picks in this forum board returns several examples with code... like this one for example: http://www.leadwerks...__fromsearch__1 the search option is your friend... 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...
Marleys Ghost Posted February 2, 2012 Share Posted February 2, 2012 2 Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
Andy Gilbert Posted February 2, 2012 Author Share Posted February 2, 2012 Managed to do it in the end, thats for the help, appreciated. Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d 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.