THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/09/2012 at 09:38, xxxxxxxx wrote:
Cinema 4D Version: 14
Platform: Windows ;
Language(s) : C++ ;
I am playing around trying to create a visual measuring line for the viewport. Ultimately I want to be able to click on a point on an object, and draw a line from the object point to any other point in space and determine the length of that line. for example, if I click on a point of a cube, then drag my mouse out to some arbitrary point in the viewport, I was to be able to determine the distance between the two points.
So to accomplish this I have been trying getting the object point, we'll call it (A) and the point where the mouse is, we'll call it (B) and then drawing a line between the two... so I say
A = WS(point);
B = Vector(x, y, 0);
bd->DrawLine(A, B, NOCLIP_Z);
then I want to get the length of the line to use it as a measurement.
So I do
Real length = Len(A - B);
the problem is I get very wrong numbers when I do this..
let's say I draw a line from one point in a cube to the other, and expect that the distance between the two points is 200. the numbers I get from my setup is like 500...
Any thoughts on what I might be doing wrong?
On 06/09/2012 at 05:42, xxxxxxxx wrote:
It looks like you're converting to screen coordinates, but not converting back to world coordinates before calling the Len() function.
On 06/09/2012 at 08:12, xxxxxxxx wrote:
Ah.. Thanks Dan! Should've caught that. I appreciate it!
On 12/09/2012 at 03:16, xxxxxxxx wrote:
Just in case you missed it, are you aware of Cinema's Measure & Construction tool? Seems to do the same.