Skip to content

Commit 873ebd3

Browse files
committed
close DRE-1480
1 parent 9877ea7 commit 873ebd3

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

docs/guide/physics.mdx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,21 @@ export default class MyBehavior extends Behavior {
5454
```
5555

5656
## Ray Casting
57+
5758
```ts
58-
let ray = new RAPIER.Ray({ x: 0, y: 0 }, {
59-
x: 0.0,
60-
y: 1,
61-
});
59+
let ray = new RAPIER.Ray(
60+
{ x: 0, y: 0 },
61+
{
62+
x: 0.0,
63+
y: 1,
64+
},
65+
);
6266
// an upward line four units long
6367
let maxToi = 4.0;
6468
let solid = true;
6569
const result = this.game.physics.world.castRay(ray, maxToi, solid);
6670

6771
if (result) {
68-
const hitEntity: Entity = this.game.entities.lookupByRef(
69-
result!.collider.userData.entityRef,
70-
)!;
72+
const hitEntity: Entity = this.game.physics.lookupEntity(result!.collider)!;
7173
}
72-
```
74+
```

0 commit comments

Comments
 (0)