Skip to content

Commit 2561009

Browse files
committed
Big update for 2016.
1 parent 593e7a3 commit 2561009

File tree

935 files changed

+88911
-124990
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

935 files changed

+88911
-124990
lines changed

2014.03.15/graph.png

68.9 KB
Loading

2014.03.15/results.md

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
### Old results (15 March 2014):
2+
3+
<center>
4+
5+
| | ms/frame | 5th %ile | 95th %ile | Ratio to C |
6+
|---------------------------|----------|----------|-----------|------------|
7+
|C (clang-500.2.79) | 2.14 | 1.89 | 2.41 | 1.00 |
8+
|pNaCl | 2.61 | 2.31 | 2.92 | 1.22 |
9+
|asm.js (Firefox 27) | 3.24 | 3.00 | 4.00 | 1.51 |
10+
|Flash/Crossbridge (\*) | 5.16 | 4.16 | 7.81 | 2.41 |
11+
|asm.js (Chrome 33) | 5.43 | 4.00 | 6.00 | 2.54 |
12+
|Java (1.8) | 5.71 | 5.00 | 6.00 | 2.67 |
13+
|AS3 | 8.15 | 7.00 | 9.00 | 3.81 |
14+
|asm.js (IE11) | 9.54 | 7.00 | 12.0 | 4.46 |
15+
|Dart (Dartium) | 10.8 | 9.00 | 14.0 | 5.05 |
16+
|Box2dWeb (Firefox 27) | 10.9 | 10.0 | 11.0 | 5.10 |
17+
|Box2dWeb (Chrome 33) | 14.5 | 12.0 | 18.0 | 6.78 |
18+
|Box2dWeb (Safari 7) | 15.5 | 13.0 | 19.0 | 7.24 |
19+
|Box2dWeb (IE11) | 15.6 | 13.0 | 21.0 | 7.29 |
20+
|Dart2js (Chrome 33) | 30.6 | 26.0 | 35.0 | 14.3 |
21+
|asm.js (Safari 7) (\*\*) | 272. | 240. | 309. | 127. |
22+
23+
</center>
24+
25+
[Test platform: MacBook Pro, 2.3 GHz i7, 16G memory, Mac OS X 10.9.2, Windows 7.
26+
All platform and compiler versions are latest unless otherwise specified.]
27+
28+
(*) Crossbridge is exhibiting some kind of problem calculating 5th %ile, so I
29+
just set it to the mean - 1.
30+
31+
(**) asm.js performs so badly on Safari 7 that I left it off the graph to
32+
avoid making it impossible to read.
33+
34+
<center>
35+
![](graph.png)
36+
37+
Scaled to multiples of native performance. The white line denotes the mean,
38+
and the edges of the box denote the 5th and 95th %iles.
39+
</center>

README.md

+42-40
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,41 @@ A simple VM performance benchmark suite that attempts to guage the performance o
44
workload using the Box2D (http://box2d.org/) physics library. This library is particularly suited to benchmarking
55
VM performance because it's compute-intensive, often a real-world performance bottleneck in games, and has been
66
ported to many languages. You can find more background [here](http://j15r.com/blog/2011/12/15/Box2D_as_a_Measure_of_Runtime_Performance),
7-
[here](http://j15r.com/blog/2013/04/25/Box2d_Revisited), and [here](http://j15r.com/blog/2013/04/25/Box2d_Addendum).
7+
[here](http://j15r.com/blog/2013/04/25/Box2d_Revisited), and [here](http://j15r.com/blog/2013/07/05/Box2d_Addendum).
88

9-
### Current results (as of 15 March 2014):
9+
### Current results (as of 5 June 2016):
1010

1111
<center>
1212

1313
| | ms/frame | 5th %ile | 95th %ile | Ratio to C |
1414
|---------------------------|----------|----------|-----------|------------|
15-
|C (clang-500.2.79) | 2.14 | 1.89 | 2.41 | 1.00 |
16-
|pNaCl | 2.61 | 2.31 | 2.92 | 1.22 |
17-
|asm.js (Firefox 27) | 3.24 | 3.00 | 4.00 | 1.51 |
18-
|Flash/Crossbridge (\*) | 5.16 | 4.16 | 7.81 | 2.41 |
19-
|asm.js (Chrome 33) | 5.43 | 4.00 | 6.00 | 2.54 |
20-
|Java (1.8) | 5.71 | 5.00 | 6.00 | 2.67 |
21-
|AS3 | 8.15 | 7.00 | 9.00 | 3.81 |
22-
|asm.js (IE11) | 9.54 | 7.00 | 12.0 | 4.46 |
23-
|Dart (Dartium) | 10.8 | 9.00 | 14.0 | 5.05 |
24-
|Box2dWeb (Firefox 27) | 10.9 | 10.0 | 11.0 | 5.10 |
25-
|Box2dWeb (Chrome 33) | 14.5 | 12.0 | 18.0 | 6.78 |
26-
|Box2dWeb (Safari 7) | 15.5 | 13.0 | 19.0 | 7.24 |
27-
|Box2dWeb (IE11) | 15.6 | 13.0 | 21.0 | 7.29 |
28-
|Dart2js (Chrome 33) | 30.6 | 26.0 | 35.0 | 14.3 |
29-
|asm.js (Safari 7) (\*\*) | 272. | 240. | 309. | 127. |
30-
|Node.js (box2d.js) | TBD | TBD | TDB | TBD |
31-
|Node.js (box2d-native) | TBD | TBD | TDB | TBD |
15+
|C (clang-500.2.79) | 2.05 | 1.80 | 2.30 | 1.00 |
16+
|pNaCl | 2.32 | 1.99 | 2.70 | 1.13 |
17+
|asm.js (Firefox 46) | 2.63 | 2.00 | 3.00 | 1.28 |
18+
|Java (1.8) | 3.31 | 3.00 | 4.00 | 1.62 |
19+
|asm.js (Chrome 51) | 3.47 | 3.00 | 4.00 | 1.69 |
20+
|asm.js (Safari 9.1) | 3.94 | 3.00 | 5.00 | 1.92 |
21+
|asm.js (MS Edge) (\*) | 4.18 | 3.00 | 5.00 | 2.03 |
22+
|Dart VM (1.16) | 5.04 | 4.00 | 7.00 | 2.46 |
23+
|Box2dWeb (Chrome 51) | 5.68 | 5.00 | 7.00 | 2.77 |
24+
|Box2dWeb (Firefox 46) | 6.75 | 6.00 | 8.00 | 3.29 |
25+
|Box2dWeb (MS Edge) (\*) | 7.72 | 6.00 | 9.00 | 3.77 |
26+
|Box2dWeb (Safari 9.1) | 8.20 | 7.00 | 10.0 | 4.00 |
27+
|AS3 | 9.95 | 9.00 | 12.0 | 4.85 |
28+
|Dart2js (Chrome 51) | 11.1 | 10.0 | 14.0 | 5.42 |
3229

3330
</center>
3431

35-
[Test platform: MacBook Pro, 2.3 GHz i7, 16G memory, Mac OS X 10.9.2, Windows 7.
32+
[Test platform: MacBook Pro, 2.3 GHz i7, 16G memory, Mac OS X 10.11.5, Windows 10.
3633
All platform and compiler versions are latest unless otherwise specified.]
3734

38-
(*) Crossbridge is exhibiting some kind of problem calculating 5th %ile, so I
39-
just set it to the mean - 1.
40-
41-
(**) asm.js performs so badly on Safari 7 that I left it off the graph to
42-
avoid making it impossible to read.
35+
(*) I don't have any easy way to run Windows natively on my Mac (I'm not going
36+
to setup dual boot partitions just for this benchmark), so I had to try and
37+
back out IE10 numbers using Parallels. I calculated a performance penalty
38+
ratio by running the Javascript benchmarks on Chrome/Mac and Chrome/Win (VM)
39+
(`7.73ms / 5.68ms = 1.36x`), then used that to adjust the MS Edge numbers.
40+
There are all sorts of things that could be wrong with this, but I expect it
41+
at least gives us a rough idea.
4342

4443
<center>
4544
![](graph.png)
@@ -48,10 +47,20 @@ avoid making it impossible to read.
4847
and the edges of the box denote the 5th and 95th %iles.
4948
</center>
5049

50+
### Notes since last time
51+
52+
- Update C code to Box2D_2.3.1.
53+
- Removed Crossbridge, as it's getting kind of long in the tooth and I don't really feel like building it.
54+
- Removed the asm.js build in /c, because there's a maintained js port available that's already compiled.
55+
- Removed Dartium, as it no longer exists (the Dart VM fills this role now).
56+
- AS3 is a bit slower (on Chrome) than last time, possibly because it's been changed from an NPAPI plugin to Pepper.
57+
- Added box2d-html5 (https://github.com/mvasilkov/box2d-html5) to the js benchmarks, but it's significantly slower
58+
than the old one, so I didn't bother adding it to the benchmarks.
5159

5260
### Old Results:
5361

5462
[5 July 2013](2013.07.05/results.md)
63+
[15 March 2014](2013.07.05/results.md)
5564

5665

5766
### Mini FAQ:
@@ -80,48 +89,41 @@ avoid making it impossible to read.
8089
- GCC or Clang: If you're running these benchmarks, you should know how to get this.
8190
- JDK: I believe any JDK after 1.5 will work; I'm using 1.8.
8291
- NaCl SDK: https://developers.google.com/native-client/sdk/download
83-
- Emscripten: https://github.com/kripken/emscripten/wiki (there's a binary build available now)
8492
- Flex SDK: http://www.adobe.com/devnet/flex/flex-sdk-download.html
85-
- Adobe Crossbridge: http://adobe-flash.github.io/crossbridge/
86-
- Dart SDK and Dartium: http://www.dartlang.org/tools/sdk/
93+
- Dart SDK and VM: http://www.dartlang.org/tools/sdk/
8794
- Node.js and NPM: https://nodejs.org/
8895

8996

9097
## Environment variables (largely to locate the above tools):
9198

9299
- `$FLEX_SDK`: Flex SDK directory (e.g., `/opt/flex_sdk_4.6`)
93-
- `$EMSCRIPTEN`: Directory containing the built emscripten compiler (e.g., `~/src/emcscripten`)
94-
- `$LLVM`: Directory containing the `llvm` binaries (e.g., `/usr/local/bin`)
95-
- `$NACL_SDK`: Directory containing the NaCl SDK version you want to use (e.g., `/opt/nacl_sdk/pepper_26`)
96-
- `$CROSSBRIDGE`: (e.g., `/opt/crossbridge/sdk`)
100+
- `$NACL_SDK_ROOT`: Directory containing the NaCl SDK version you want to use (e.g., `/opt/nacl_sdk/pepper_49`)
97101

98102

99103
## Targets:
100104

101105
- /c:
102106
- c: `make -f bench2d.mk; bench2d`
103-
- asm.js: `make -f bench2d.asmjs.mk` (open bench2d_asm.js.html -- in Firefox nightly to see asm.js optimizations)
104-
- nacl: `make -f bench2d.nacl.mk; python httpd.py` (open http://localhost:5103/bench2d_nacl.html in Chrome -- it won't work from a file:// url)
105-
- crossbridge: `./make-crossbridge; crossbridge_build/bench2d_crossbridge` (or open crossbridge_build/bench2d_crossbridge.swf in the standalone Flash Player)
107+
- pnacl: `make -f bench2d.pnacl.mk; python httpd.py` (open http://localhost:5103/bench2d_nacl.html in Chrome -- it won't work from a file:// url)
106108
- /java:
107109
- `ant run`
108110
- /js:
109-
- `run-d8` (if you have V8's standalone shell, or open bench2d_run.html in your favorite browser)
111+
- `run-d8` (if you have V8's standalone shell)
112+
- Or open bench2d_run.html in your favorite browser
110113
- /as3:
111114
- `./build` (open Bench2d.html in your favorite browser, or Bench2d.swf in the standalone Flash Player)
112115
- (There's also a version that uses the "Nape" physics library, but this is not relevent to VM benchmarking)
113116
- /dart:
114117
- `pub update; dart bench2d.dart`
115118
- /dart (dart2js):
116-
- `dart2js -o bench2d.dart.js; open dart/bench2d.html in Dartium or another browser`
119+
- `pub serve; open http://localhost:8080/bench2d.html`
117120
- /nodejs
118-
- `npm install; node index.js`
121+
- `npm install; node index.js` (NOTE: This isn't working at the moment, but isn't directly relevant to benchmarking)
119122

120123

121124
## Future work
122125

123126
- Find or build a better Javascript port of Box2D.
124127
- Find a way to automate the benchmarks.
125128
- Make the timer resolution less bad.
126-
- Benchmark .NET
127-
- Benchmark Node.js
129+
- Benchmark .NET, Android's Java VM

as3/NapeLib/bin/nape-release.swc

2.22 KB
Binary file not shown.

c/.gitignore

-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
*.nexe
2-
dbg_x86_32
3-
dbg_x86_64
4-
opt_x86_32
5-
opt_x86_64
61
build
72
bench2d
8-
*.bc
93
*.o
10-
crossbridge_build
114
pnacl

c/Bench2d.bc

6.56 KB
Binary file not shown.

c/Box2D_v2.2.1/Box2D/Box2D.h renamed to c/Box2D_2.3.1/Box2D/Box2D.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,13 @@ For discussion please visit http://box2d.org/forum
5656
#include <Box2D/Dynamics/Joints/b2DistanceJoint.h>
5757
#include <Box2D/Dynamics/Joints/b2FrictionJoint.h>
5858
#include <Box2D/Dynamics/Joints/b2GearJoint.h>
59-
#include <Box2D/Dynamics/Joints/b2WheelJoint.h>
59+
#include <Box2D/Dynamics/Joints/b2MotorJoint.h>
6060
#include <Box2D/Dynamics/Joints/b2MouseJoint.h>
6161
#include <Box2D/Dynamics/Joints/b2PrismaticJoint.h>
6262
#include <Box2D/Dynamics/Joints/b2PulleyJoint.h>
6363
#include <Box2D/Dynamics/Joints/b2RevoluteJoint.h>
6464
#include <Box2D/Dynamics/Joints/b2RopeJoint.h>
6565
#include <Box2D/Dynamics/Joints/b2WeldJoint.h>
66+
#include <Box2D/Dynamics/Joints/b2WheelJoint.h>
6667

6768
#endif
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# -*- cmake -*-
2+
#
3+
# Box2dConfig.cmake(.in)
4+
#
5+
6+
# Use the following variables to compile and link against Box2d:
7+
# BOX2D_FOUND - True if Box2d was found on your system
8+
# BOX2D_USE_FILE - The file making Box2d usable
9+
# BOX2D_DEFINITIONS - Definitions needed to build with Box2d
10+
# BOX2D_INCLUDE_DIR - Box2d headers location
11+
# BOX2D_INCLUDE_DIRS - List of directories where Box2d header file are
12+
# BOX2D_LIBRARY - Library name
13+
# BOX2D_LIBRARIES - List of libraries to link against
14+
# BOX2D_LIBRARY_DIRS - List of directories containing Box2d libraries
15+
# BOX2D_ROOT_DIR - The base directory of Box2d
16+
# BOX2D_VERSION_STRING - A human-readable string containing the version
17+
18+
set ( BOX2D_FOUND 1 )
19+
set ( BOX2D_USE_FILE "@BOX2D_USE_FILE@" )
20+
21+
set ( BOX2D_DEFINITIONS "@BOX2D_DEFINITIONS@" )
22+
set ( BOX2D_INCLUDE_DIR "@BOX2D_INCLUDE_DIR@" )
23+
set ( Box2D_INCLUDE_DIRS "@BOX2D_INCLUDE_DIRS@" ) # deprecated
24+
set ( BOX2D_INCLUDE_DIRS "@BOX2D_INCLUDE_DIRS@" )
25+
set ( BOX2D_LIBRARY "@BOX2D_LIBRARY@" )
26+
set ( BOX2D_LIBRARIES "@BOX2D_LIBRARIES@" )
27+
set ( BOX2D_LIBRARY_DIRS "@BOX2D_LIBRARY_DIRS@" )
28+
set ( BOX2D_ROOT_DIR "@CMAKE_INSTALL_PREFIX@" )
29+
30+
set ( BOX2D_VERSION_STRING "@BOX2D_VERSION@" )
31+

c/Box2D_v2.2.1/Box2D/CMakeLists.txt renamed to c/Box2D_2.3.1/Box2D/CMakeLists.txt

+18-5
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ set(BOX2D_Joints_SRCS
8989
Dynamics/Joints/b2FrictionJoint.cpp
9090
Dynamics/Joints/b2GearJoint.cpp
9191
Dynamics/Joints/b2Joint.cpp
92+
Dynamics/Joints/b2MotorJoint.cpp
9293
Dynamics/Joints/b2MouseJoint.cpp
9394
Dynamics/Joints/b2PrismaticJoint.cpp
9495
Dynamics/Joints/b2PulleyJoint.cpp
@@ -102,6 +103,7 @@ set(BOX2D_Joints_HDRS
102103
Dynamics/Joints/b2FrictionJoint.h
103104
Dynamics/Joints/b2GearJoint.h
104105
Dynamics/Joints/b2Joint.h
106+
Dynamics/Joints/b2MotorJoint.h
105107
Dynamics/Joints/b2MouseJoint.h
106108
Dynamics/Joints/b2PrismaticJoint.h
107109
Dynamics/Joints/b2PulleyJoint.h
@@ -193,13 +195,24 @@ if(BOX2D_INSTALL)
193195

194196
# install libraries
195197
if(BOX2D_BUILD_SHARED)
196-
install(TARGETS Box2D_shared EXPORT Box2D-targets DESTINATION lib)
198+
install(TARGETS Box2D_shared EXPORT Box2D-targets
199+
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
200+
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
201+
RUNTIME DESTINATION bin)
197202
endif()
198203
if(BOX2D_BUILD_STATIC)
199-
install(TARGETS Box2D EXPORT Box2D-targets DESTINATION lib)
204+
install(TARGETS Box2D EXPORT Box2D-targets DESTINATION ${LIB_INSTALL_DIR})
200205
endif()
201206

202207
# install build system hooks for third-party apps
203-
install(EXPORT Box2D-targets DESTINATION lib/Box2D)
204-
install(FILES Box2DConfig.cmake DESTINATION lib/Box2D)
205-
endif(BOX2D_INSTALL)
208+
install(EXPORT Box2D-targets DESTINATION ${LIB_INSTALL_DIR}/Box2D)
209+
210+
set (BOX2D_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/include)
211+
set (BOX2D_INCLUDE_DIRS ${BOX2D_INCLUDE_DIR} )
212+
set (BOX2D_LIBRARY_DIRS ${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR})
213+
set (BOX2D_LIBRARY Box2D)
214+
set (BOX2D_LIBRARIES ${BOX2D_LIBRARY})
215+
set (BOX2D_USE_FILE ${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}/cmake/Box2D/UseBox2D.cmake)
216+
configure_file(Box2DConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/Box2DConfig.cmake @ONLY ESCAPE_QUOTES)
217+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Box2DConfig.cmake UseBox2D.cmake DESTINATION ${LIB_INSTALL_DIR}/cmake/Box2D)
218+
endif(BOX2D_INSTALL)
Binary file not shown.

c/Box2D_v2.2.1/Box2D/Collision/Shapes/b2ChainShape.cpp renamed to c/Box2D_2.3.1/Box2D/Collision/Shapes/b2ChainShape.cpp

+24-2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,14 @@
1919
#include <Box2D/Collision/Shapes/b2ChainShape.h>
2020
#include <Box2D/Collision/Shapes/b2EdgeShape.h>
2121
#include <new>
22-
#include <cstring>
23-
using namespace std;
22+
#include <string.h>
2423

2524
b2ChainShape::~b2ChainShape()
25+
{
26+
Clear();
27+
}
28+
29+
void b2ChainShape::Clear()
2630
{
2731
b2Free(m_vertices);
2832
m_vertices = NULL;
@@ -33,6 +37,14 @@ void b2ChainShape::CreateLoop(const b2Vec2* vertices, int32 count)
3337
{
3438
b2Assert(m_vertices == NULL && m_count == 0);
3539
b2Assert(count >= 3);
40+
for (int32 i = 1; i < count; ++i)
41+
{
42+
b2Vec2 v1 = vertices[i-1];
43+
b2Vec2 v2 = vertices[i];
44+
// If the code crashes here, it means your vertices are too close together.
45+
b2Assert(b2DistanceSquared(v1, v2) > b2_linearSlop * b2_linearSlop);
46+
}
47+
3648
m_count = count + 1;
3749
m_vertices = (b2Vec2*)b2Alloc(m_count * sizeof(b2Vec2));
3850
memcpy(m_vertices, vertices, count * sizeof(b2Vec2));
@@ -47,11 +59,21 @@ void b2ChainShape::CreateChain(const b2Vec2* vertices, int32 count)
4759
{
4860
b2Assert(m_vertices == NULL && m_count == 0);
4961
b2Assert(count >= 2);
62+
for (int32 i = 1; i < count; ++i)
63+
{
64+
// If the code crashes here, it means your vertices are too close together.
65+
b2Assert(b2DistanceSquared(vertices[i-1], vertices[i]) > b2_linearSlop * b2_linearSlop);
66+
}
67+
5068
m_count = count;
5169
m_vertices = (b2Vec2*)b2Alloc(count * sizeof(b2Vec2));
5270
memcpy(m_vertices, vertices, m_count * sizeof(b2Vec2));
71+
5372
m_hasPrevVertex = false;
5473
m_hasNextVertex = false;
74+
75+
m_prevVertex.SetZero();
76+
m_nextVertex.SetZero();
5577
}
5678

5779
void b2ChainShape::SetPrevVertex(const b2Vec2& prevVertex)

c/Box2D_v2.2.1/Box2D/Collision/Shapes/b2ChainShape.h renamed to c/Box2D_2.3.1/Box2D/Collision/Shapes/b2ChainShape.h

+5-2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ class b2ChainShape : public b2Shape
3737
/// The destructor frees the vertices using b2Free.
3838
~b2ChainShape();
3939

40+
/// Clear all data.
41+
void Clear();
42+
4043
/// Create a loop. This automatically adjusts connectivity.
4144
/// @param vertices an array of vertices, these are copied
4245
/// @param count the vertex count
@@ -95,8 +98,8 @@ inline b2ChainShape::b2ChainShape()
9598
m_radius = b2_polygonRadius;
9699
m_vertices = NULL;
97100
m_count = 0;
98-
m_hasPrevVertex = NULL;
99-
m_hasNextVertex = NULL;
101+
m_hasPrevVertex = false;
102+
m_hasNextVertex = false;
100103
}
101104

102105
#endif
Binary file not shown.

c/Box2D_v2.2.1/Box2D/Collision/Shapes/b2CircleShape.cpp renamed to c/Box2D_2.3.1/Box2D/Collision/Shapes/b2CircleShape.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
#include <Box2D/Collision/Shapes/b2CircleShape.h>
2020
#include <new>
21-
using namespace std;
2221

2322
b2Shape* b2CircleShape::Clone(b2BlockAllocator* allocator) const
2423
{
Binary file not shown.

c/Box2D_v2.2.1/Box2D/Collision/Shapes/b2EdgeShape.cpp renamed to c/Box2D_2.3.1/Box2D/Collision/Shapes/b2EdgeShape.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
#include <Box2D/Collision/Shapes/b2EdgeShape.h>
2020
#include <new>
21-
using namespace std;
2221

2322
void b2EdgeShape::Set(const b2Vec2& v1, const b2Vec2& v2)
2423
{
@@ -105,11 +104,11 @@ bool b2EdgeShape::RayCast(b2RayCastOutput* output, const b2RayCastInput& input,
105104
output->fraction = t;
106105
if (numerator > 0.0f)
107106
{
108-
output->normal = -normal;
107+
output->normal = -b2Mul(xf.q, normal);
109108
}
110109
else
111110
{
112-
output->normal = normal;
111+
output->normal = b2Mul(xf.q, normal);
113112
}
114113
return true;
115114
}
Binary file not shown.

0 commit comments

Comments
 (0)