Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Distance to picked point

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

Link to post
Share on other sites

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

Link to post
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.

Link to post
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 post
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.

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.

  • Create New...