@react-three/rapier 0.4.3 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/readme.md CHANGED
@@ -60,19 +60,39 @@ Turn off automatic collider generation globally, but apply auto generation local
60
60
  ```tsx
61
61
  const Scene = () => (
62
62
  <Physics colliders={false}>
63
+ {/* Use an automatic CuboidCollider for all meshes inside this RigidBody */}
63
64
  <RigidBody colliders="cuboid">
64
65
  <Box />
65
66
  </RigidBody>
66
67
 
68
+ {/* Use an automatic BallCollider for all meshes inside this RigidBody */}
67
69
  <RigidBody position={[0, 10, 0]} colliders="ball">
68
70
  <Sphere />
69
71
  </RigidBody>
70
72
 
73
+ {/* Make a compound shape with two custom BallColliders */}
71
74
  <RigidBody position={[0, 10, 0]}>
72
75
  <Sphere />
73
76
  <BallCollider args={0.5} />
74
77
  <BallCollider args={0.5} position={[1, 0, 0]} />
75
78
  </RigidBody>
79
+
80
+ {/* Make a compound shape with two custom BallColliders, an automatic BallCollider,
81
+ Two automatic MeshColliders, based on two different shape strategies */}
82
+ <RigidBody position={[0, 10, 0]} colliders='ball'>
83
+ <MeshCollider type="trimesh">
84
+ <mesh ... />
85
+ </MeshCollider>
86
+
87
+ <MeshCollider type="hull">
88
+ <mesh ... />
89
+ </MeshCollider>
90
+
91
+ <Sphere />
92
+
93
+ <BallCollider args={0.5} />
94
+ <BallCollider args={0.5} position={[1, 0, 0]} />
95
+ </RigidBody>
76
96
  </Physics>
77
97
  );
78
98
  ```
@@ -134,7 +154,7 @@ return (
134
154
  colliders="hull"
135
155
  onSleep={() => setIsAsleep(true)}
136
156
  onWake={() => setIsAsleep(false)}
137
- onCollision={({manifold}) => {
157
+ onCollisionEnter={({manifold}) => {
138
158
  console.log('Collision at world position ', manifold.solverContactPoint(0))
139
159
  }}
140
160
  >
@@ -146,24 +166,9 @@ return (
146
166
  }
147
167
  ```
148
168
 
149
- ## Hooks
169
+ ## Joints
150
170
 
151
- You can also use hooks to generate rigid bodies and colliders, but it's not encouraged.
152
-
153
- ```tsx
154
- import { Box } from "@react-three/drei";
155
- import { useCuboid } from "@react-three/rapier";
156
-
157
- const RigidBox = () => {
158
- // Generates a RigidBody and attaches a BoxCollider to it, returns a ref
159
- const [box, rigidBody, collider] = useCuboid(
160
- { position: [1, 1, 1] },
161
- { args: [0.5, 0.5, 0.5] }
162
- );
163
-
164
- return <Box ref={box} />;
165
- };
166
- ```
171
+ WIP
167
172
 
168
173
  ## Roadmap?
169
174
 
@@ -174,8 +179,9 @@ In order, but also not necessarily:
174
179
  - [x] Nested objects retain world transforms
175
180
  - [x] Nested objects retain correct collider scale
176
181
  - [x] Automatic colliders based on rigidbody children
177
- - [ ] Translation and rotational constraints
182
+ - [x] Translation and rotational constraints
178
183
  - [x] Collision events
184
+ - [ ] Colliders outside RigidBodies
179
185
  - [ ] InstancedMesh support
180
186
  - [ ] Docs
181
187
  - [ ] CodeSandbox examples
package/CHANGELOG.md DELETED
@@ -1,72 +0,0 @@
1
- # @react-three/rapier
2
-
3
- ## 0.4.3
4
-
5
- ### Patch Changes
6
-
7
- - f7a8a2d: Rigid body creation hooks should not use auto colliders
8
- - 663eeb5: Fix default collider setting
9
-
10
- ## 0.4.2
11
-
12
- ### Patch Changes
13
-
14
- - 387b32c: Add restitution and friction as props for auto-generated colliders on RigidBody
15
-
16
- ## 0.4.1
17
-
18
- ### Patch Changes
19
-
20
- - bb7a269: Add useful proxied api methods to rigidbody
21
-
22
- ## 0.4.0
23
-
24
- ### Minor Changes
25
-
26
- - dd535aa: Update to @dimforge/rapier3d-compat@0.8.1, pinned version
27
-
28
- ### Patch Changes
29
-
30
- - dd535aa: Better <Physics /> lifecycle making reinitialization more stable
31
-
32
- ## 0.3.1
33
-
34
- ### Patch Changes
35
-
36
- - 37d2621: Pin rapier3d version to 0.8.0-alpha.2
37
-
38
- ## 0.3.0
39
-
40
- ### Minor Changes
41
-
42
- - 7e36172: Add collision and sleep/awake events
43
-
44
- ## 0.2.0
45
-
46
- ### Minor Changes
47
-
48
- - 584ce08: Expose joint api, however no joint is returned when created (rapier bug?)
49
-
50
- ### Patch Changes
51
-
52
- - 584ce08: All parts now uses a more rigid initiation process
53
- - 584ce08: Apply bounding box offset for auto colliders
54
- - 584ce08: Use single update loop instead of individual rigid body callbacks
55
-
56
- ## 0.1.2
57
-
58
- ### Patch Changes
59
-
60
- - 4f7440c: fix: make global colliders setting progate to children
61
-
62
- ## 0.1.1
63
-
64
- ### Patch Changes
65
-
66
- - 260e6d1: Fix Physics "colliders" value not being applied in children by default
67
-
68
- ## 0.1.0
69
-
70
- ### Minor Changes
71
-
72
- - First release with base functionality of RigidBodies in Rapier