Jump to content

Distance to picked point


Arska134
 Share

Recommended Posts

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...

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

I dont think its on the wiki index, hard to tell amongst all the new commands like CheapKarelaPills() and EnhanceYour beautyByWearingJoeRodeoDiamond () ..wacko.png I think the index needs an enima.

 

http://www.leadwerks.com/wiki/index.php?title=Special:AllPages

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

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.

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

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. smile.png

Link to comment
Share on other sites

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));
}

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

I dont think its on the wiki index, hard to tell amongst all the new commands like CheapKarelaPills() and EnhanceYour beautyByWearingJoeRodeoDiamond () ..wacko.png I think the index needs an enima.

 

http://www.leadwerks...pecial:AllPages

 

lol thats funny.

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

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...