free-language / box2d

Automatically exported from code.google.com/p/box2d
0 stars 0 forks source link

Raycast demo, Raycast doesn't effect on body type 1 #103

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Start RayCast demo
2. Press 1 to drop body type 1
3.

What is the expected output? What do you see instead?
Raycast doesn't work

What version of the product are you using? On what operating system?
2.1.0

Please provide any additional information below.
Reason:
   In RayCast::Create(int32 index), there is a line
       m_userData[m_bodyIndex] = index;
   which will set index to zero. (Press '1',index parameter '1'-'1' )

   In ReportFixture functions of three callbacks, the zero index cause the 
raycast ignored.

Solution: 
   The easy way is like this:
      Change
         m_userData[m_bodyIndex] = index;
      To
         m_userData[m_bodyIndex] = index + 1;

Original issue reported on code.google.com by wqyfavo...@gmail.com on 20 Mar 2010 at 2:21

GoogleCodeExporter commented 9 years ago
This is intentional. I'm showing how to filter inside the ray cast callback.

Original comment by erinca...@gmail.com on 3 Apr 2010 at 6:56