Arska134 Posted August 5, 2012 Share Posted August 5, 2012 Is there any command to get distance from point x, y, z to x2, y2, z2. I need to get distance from camera position to picked position. Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
Road Kill Kenny Posted August 5, 2012 Share Posted August 5, 2012 Use 3D pythagorus and make it own utility function. There is no LE get distance between points only between entities: Quote STS - Scarlet Thread Studios AKA: Engineer Ken Fact: Game Development is hard... very bloody hard.. If you are not prepared to accept that.. Please give up now! Link to comment Share on other sites More sharing options...
macklebee Posted August 5, 2012 Share Posted August 5, 2012 PointDistance(p1:TVec3, p2:TVec3) or just do what it is doing and perform the math yourself distance = ( (x1 - x2)^2 + (y1 - y2)^2 + (z1 - z2)^2 )^0.5 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...
Road Kill Kenny Posted August 5, 2012 Share Posted August 5, 2012 Point distance??? is that an wiki'd command? didn't know it existed. I made my own lol. Quote STS - Scarlet Thread Studios AKA: Engineer Ken Fact: Game Development is hard... very bloody hard.. If you are not prepared to accept that.. Please give up now! Link to comment Share on other sites More sharing options...
macklebee Posted August 5, 2012 Share Posted August 5, 2012 no its not listed as a command but i found it in lua a long time ago by accident when i tried to make my own function as well and used the obvious name for the function, PointDistance()... and i noticed it turned blue in the ScriptEditor as it was recognized... i mentioned it to josh at the time and he didnt seem too concerned about putting it in the wiki / forum docs... i assume since its basic math... 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 August 5, 2012 Share Posted August 5, 2012 I dont think its on the wiki index, hard to tell amongst all the new commands like CheapKarelaPills() and EnhanceYour beautyByWearingJoeRodeoDiamond () .. I think the index needs an enima. http://www.leadwerks.com/wiki/index.php?title=Special:AllPages 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...
Rick Posted August 5, 2012 Share Posted August 5, 2012 Is there any command to get distance from point x, y, z to x2, y2, z2. I need to get distance from camera position to picked position. If you put a pivot at your picked position you could use EntityDistance(camera, pivot);. Quote Link to comment Share on other sites More sharing options...
Arska134 Posted August 5, 2012 Author Share Posted August 5, 2012 Thanks everyone. I placed pivot and works great. Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
macklebee Posted August 5, 2012 Share Posted August 5, 2012 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...
Road Kill Kenny Posted August 6, 2012 Share Posted August 6, 2012 Wait... let me get this right.... instead of steps like this: 1. PointDistance(TVec3. LE::TVec3) // If you are in bmax or LUA, otherwise simple math funciton in C++ You do this: 1. CreatePivot(); 2. PositionEntity(pivot, Vec3); 3. GetEntityDistance(pivot, camera); .... I don't see the logic here. Quote STS - Scarlet Thread Studios AKA: Engineer Ken Fact: Game Development is hard... very bloody hard.. If you are not prepared to accept that.. Please give up now! Link to comment Share on other sites More sharing options...
Rick Posted August 6, 2012 Share Posted August 6, 2012 Looks like he tagged this post as BMax. Sounded like PointDistance() is a Lua function? Could be wrong, but that's how I read the post by macklebee. If the language/library I was using already had the function, then for sure use it. If not then for me, it's about not having to think about it or implementing it every time I do a new project (which is often). I'm not very organized so I don't keep a library of common code really. I know the function already exists in LE but it just so happens it needs an entity, so this is a way to do that with using just LE code that's easier for me to remember. So I guess for me it's not about logic, it's about laziness. Quote Link to comment Share on other sites More sharing options...
Road Kill Kenny Posted August 6, 2012 Share Posted August 6, 2012 Well for anyone who wants a function for C++ that they can re-use every time its pretty simple: #include <math> float GetDistance(LE::TVec3 start, LE::TVec3 end){ return sqrt(pow(start.X-end.X, 2) + pow(start.Y-end.Y, 2) + pow(start.Z-end.Z, 2)); } Quote STS - Scarlet Thread Studios AKA: Engineer Ken Fact: Game Development is hard... very bloody hard.. If you are not prepared to accept that.. Please give up now! Link to comment Share on other sites More sharing options...
Road Kill Kenny Posted August 6, 2012 Share Posted August 6, 2012 I dont think its on the wiki index, hard to tell amongst all the new commands like CheapKarelaPills() and EnhanceYour beautyByWearingJoeRodeoDiamond () .. I think the index needs an enima. http://www.leadwerks...pecial:AllPages lol thats funny. Quote STS - Scarlet Thread Studios AKA: Engineer Ken Fact: Game Development is hard... very bloody hard.. If you are not prepared to accept that.. Please give up now! Link to comment Share on other sites More sharing options...
macklebee Posted August 6, 2012 Share Posted August 6, 2012 its in lua because it was in bmax... its not in the dll i assume because its basic math as i and ken have both shown... 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...
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.