We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9877ea7 commit 873ebd3Copy full SHA for 873ebd3
1 file changed
docs/guide/physics.mdx
@@ -54,19 +54,21 @@ export default class MyBehavior extends Behavior {
54
```
55
56
## Ray Casting
57
+
58
```ts
-let ray = new RAPIER.Ray({ x: 0, y: 0 }, {
59
- x: 0.0,
60
- y: 1,
61
-});
+let ray = new RAPIER.Ray(
+ { x: 0, y: 0 },
+ {
62
+ x: 0.0,
63
+ y: 1,
64
+ },
65
+);
66
// an upward line four units long
67
let maxToi = 4.0;
68
let solid = true;
69
const result = this.game.physics.world.castRay(ray, maxToi, solid);
70
71
if (result) {
- const hitEntity: Entity = this.game.entities.lookupByRef(
- result!.collider.userData.entityRef,
- )!;
72
+ const hitEntity: Entity = this.game.physics.lookupEntity(result!.collider)!;
73
}
-```
74
+```
0 commit comments