Jump to content

pick.entity


Dozz
 Share

Recommended Posts

Well, I am getting on well with my cpp testing, achieving results in hours whereas I was expecting a big learning curve. Leadwerks & this forum = great.

Using CameraPick, I am selecting and highlighting objects no problem, and displaying pick.X etc..

 

I have defined:

float distanceto = 0.0;

 

and inside the main loop:

DrawText(10,70,"distance: %f",distanceto);

 

after the CameraPick:

distanceto = EntityDistance(cam,pick.entity);

 

...this does give the distance to the selected object ok, but to its pivot point. I want the distance to the exact picked point on the object given in pick.X, .Y & .Z

What is the proper way to do that? I know its not to work out the trig manually between x,y & z points.

 

Thanks for your help

Link to comment
Share on other sites

I know its not to work out the trig manually between x,y & z points.

Well thats exactly how I do it! I wrote a small function that takes two vec3s for the positions and uses pythagoras to work out the distance returning the float.

 

Failing that, you could temporarily position a pivot entity at that position and use that in the EntityDistance function.

Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++

Link to comment
Share on other sites

dx = pick.position.x - camera.position.x

dy = pick.position.y - camera.position.y

dz = pick.position.z - camera.position.z

d = sqrt(dx*dx+dy*dy+dz*dz)

My job is to make tools you love, with the features you want, and performance you can't live without.

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