Report any bugs here and we'll post fixes
Moderators: Sascha Willems, Thomas
by Rasarasa » Tue Dec 21, 2010 7:50 pm
Raycasting using a direction vector with a small magnitude, cause the raycast to hit bodies not on the ray. The distance between the origin and the body does not mater. Is this a bug or is the raycasting implemented in a way that require the ray direction to be huge? If so how does it actualy work? Does it go through every body in the scene?
Im using version 2.26
-
Rasarasa
-
- Posts: 8
- Joined: Tue Dec 21, 2010 7:34 pm
by Rasarasa » Tue Dec 21, 2010 8:19 pm
With a small direction, the ray can also only hit objects if the ray is pointing somewhat to the origin.
-
Rasarasa
-
- Posts: 8
- Joined: Tue Dec 21, 2010 7:34 pm
by Julio Jerez » Tue Dec 21, 2010 8:20 pm
Ray cast should work for all rays, all all lenght, on any circuntance and should always be 100% correct..
all of the custom joints that use Ray casting use very short rays, and they seem to work fine.
do you have a test to show the bug?
-
Julio Jerez
- Moderator
-
- Posts: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Rasarasa » Tue Dec 21, 2010 9:32 pm
-
Rasarasa
-
- Posts: 8
- Joined: Tue Dec 21, 2010 7:34 pm
by Rasarasa » Wed Dec 22, 2010 8:24 am
I also tried it with Tutorial_104_RayCastAndConvexCast, by scaling the direction. It buged there to.
- Code: Select all
dVector p0 (ScreenToWorld(dVector (cursorPosit1.m_x, cursorPosit1.m_y, 0.0f, 0.0f)));
dVector p1 (ScreenToWorld(dVector (cursorPosit1.m_x, cursorPosit1.m_y, 1.0f, 0.0f)));
//Added this
p1 = p1.Scale(0.0001);
pickedBody = NULL;
pickedParam = 1.1f;
isPickedBodyDynamics = false;
NewtonWorldRayCast(nWorld, &p0[0], &p1[0], RayCastFilter, NULL, RayCastPrefilter);
-
Rasarasa
-
- Posts: 8
- Joined: Tue Dec 21, 2010 7:34 pm
by Julio Jerez » Wed Dec 22, 2010 12:17 pm
dVector p0 (ScreenToWorld(dVector (cursorPosit1.m_x, cursorPosit1.m_y, 0.0f, 0.0f)));
dVector p1 (ScreenToWorld(dVector (cursorPosit1.m_x, cursorPosit1.m_y, 1.0f, 0.0f)));
//Added this
p1 = p1.Scale(0.0001);
what you are doing does not make sence, if you multiply p1 by 0.0001 you are shooting a ray tor the origin of the world.
what do you expect the function to do? along that direction thre are not bodies to pick,
I suggest check out what you are doing, I am no going to debug random thing ta make no sence.
-
Julio Jerez
- Moderator
-
- Posts: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Rasarasa » Wed Dec 22, 2010 12:57 pm
I thought that the raycast used a ray (origin and direction with infinite length). But from what you said, the raycast does not use a ray, but a line start poin and end point). But in that case it isn't a raycast, its a line/polygon colision test? Or i might be wrong? Anyway, there is no bug then. Thanks for the quick reply!
-
Rasarasa
-
- Posts: 8
- Joined: Tue Dec 21, 2010 7:34 pm
by Julio Jerez » Wed Dec 22, 2010 1:19 pm
Ray cast trace a line for p0 to p1 in global space.
-
Julio Jerez
- Moderator
-
- Posts: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
Return to Bugs and Fixes
Who is online
Users browsing this forum: No registered users and 4 guests