Collision within a Radius
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 07/04/2011 at 08:14, xxxxxxxx wrote:
You cold try using PointLineDistance instead. If the distance from the handle to the ray is less than the desired radius, you have a hit.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 07/04/2011 at 09:35, xxxxxxxx wrote:
So if I wanted to use PointLineDistance()...
Would it be like this?
PointLineDistance(wtail, whead, res.hitpos);
Also, is the Vector that is returned by this function the distance fromt the point to the ray? -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 07/04/2011 at 09:44, xxxxxxxx wrote:
Or would I instead do:
PointLineDistance(wtail, oray, res.hitpos); -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 07/04/2011 at 13:32, xxxxxxxx wrote:
okay using the last code i posted the res.hitpos always returns 0,0,0
Anyone have any idea why?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 07/04/2011 at 14:52, xxxxxxxx wrote:
(0,0,0) is correct.
Because you calculate the distance between your 'intersection line' and a hit point of the intersection.
A Point at a line = distance = 0.
You should do it maybe with points of a polygon near the hit point.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 07/04/2011 at 16:16, xxxxxxxx wrote:
Like this?
Vector distance = PointLineDistance(wtail, oray, pObj->GetMg().off);
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 07/04/2011 at 16:25, xxxxxxxx wrote:
How does the vector returned by PointLineDistance() represent the distance,,, what does each Real in the Vector represent?
for example when I use the above line I get a bunch of different numbers and those numbers do not seem to be the same when the camera is in different places..
Hopefully that makes sense.. lol
~Shawn
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 07/04/2011 at 16:44, xxxxxxxx wrote:
The ray should be in the same space as the object and the shortest distance is the length of the returned vector.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 07/04/2011 at 17:27, xxxxxxxx wrote:
okay I've got it work using
Vector distance = PointLineDistance(wtail, whead, pObj->GetMg().off); Real disX = distance.x; Real disY = distance.y; Real disZ = distance.z; //if (cRay->GetNearestIntersection(&res)) if((disX > -20 && disX < 20) && (disY > -20 && disY < 20) && (disZ > -20 && disZ < 20)) { //GePrint("A COLLISION HAS OCCURRED"); return TRUE; }
now in order to make this whole thing work the right way I need to be able to capture the initial mouse location when the mouse is clicked and dragged and then not get the mouse location while it is dragging.. So basically I want the mouse location where the user clicks but then I don't want the location while the mouse is dragging.
Is this possible... I currently use BFM_INPUT_X & BFM_INPUT_Y to get the mouse location but this value changes as the mouse is dragging.
Thanks,
Shawn
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 07/04/2011 at 18:24, xxxxxxxx wrote:
Just use GetLength(), e.g.
const Real threshold = 10.0; Real dist = result.GetLength(); if(dist <= threshold) return TRUE;
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 07/04/2011 at 18:35, xxxxxxxx wrote:
Thank you David that is much cleaner..
Vector distance = PointLineDistance(wtail, whead, pObj->GetMg().off); const Real threshold = 20.0; Real dist = distance.GetLength(); if(dist <= threshold) { //GePrint("A COLLISION HAS OCCURED"); return TRUE; }
Anyone know about getting the mouse position of the initial click when doing a mouse drag?
Thanks,
Shawn
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 07/04/2011 at 23:12, xxxxxxxx wrote:
Hello,
a question where you perform this?
if you hare in mouse input you can use ViewPortSelect::PickObject()
this will fill a c4dobjectlist with all obj in the radius in z order.
it will have not very good performance but can solve the situation.try it
all the best
Franz -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 08/04/2011 at 02:50, xxxxxxxx wrote:
Hi Franz. Thanks, I am able to select within a set radius now. See the last code I posted. Now I am trying to figure out how to capture the screen coordinates of the first initial mouse click when the user drags the mouse. I do not want to keep storing the mouse position after that first click so I need to figure out how to store only that first click.
Thanks,
Shawn
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 08/04/2011 at 07:40, xxxxxxxx wrote:
This is from the liquid draw example in the SDK.
Seems to work.Real mx = msg.GetReal(BFM_INPUT_X); Real my = msg.GetReal(BFM_INPUT_Y); GePrint(RealToString(mx)); GePrint(RealToString(my));
-ScottA
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 08/04/2011 at 08:27, xxxxxxxx wrote:
Howdy,
Originally posted by xxxxxxxx
...Now I am trying to figure out how to capture the screen coordinates of the first initial mouse click when the user drags the mouse. I do not want to keep storing the mouse position after that first click so I need to figure out how to store only that first click....
If you store the mouse x and y in local variables startx and starty, and do that before the while loop, those variables won't change during the dragging.
Adios,
Cactus Dan