Skip to content

Commit efdc182

Browse files
yolo
Pull request for issue #81
2 parents 675a338 + c96a8e8 commit efdc182

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

cave-game/server/entities/PlayerEntity.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,10 @@ export class PlayerEntity extends Entity {
189189
lastFoundAnchor: GrappleAnchorEntity | null = null;
190190
lastAnchor: GrappleAnchorEntity | null = null;
191191
findGrappleAnchor(lookDir: YXZEuler): GrappleAnchorEntity | null {
192+
const dir = new phys.Vec3(-Math.sin(lookDir.y), Math.sin(lookDir.x), -Math.cos(lookDir.y)).unit();
192193
const objects = this.game.raycast(
193-
this.body.position,
194-
new phys.Vec3(-Math.sin(lookDir.y), Math.sin(lookDir.x), -Math.cos(lookDir.y))
195-
.unit()
196-
.scale(100)
197-
.vadd(this.body.position),
194+
this.body.position.vadd(dir.clone().scale(2)), // start the ray 2 units in front of the player
195+
dir.scale(100).vadd(this.body.position),
198196
{},
199197
this,
200198
);

0 commit comments

Comments
 (0)