Skip to content

Commit

Permalink
chore: update engine
Browse files Browse the repository at this point in the history
  • Loading branch information
piellardj committed Nov 18, 2024
1 parent 953b87f commit ef4d566
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 11 deletions.
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"publish:mainnet": "git tag mainnet-$(node -p -e \"require('./package.json').version\") && git push origin mainnet-$(node -p -e \"require('./package.json').version\")"
},
"dependencies": {
"@aresrpg/aresrpg-engine": "2.6.1",
"@aresrpg/aresrpg-engine": "^2.6.2",
"@aresrpg/aresrpg-protocol": "5.1.3",
"@aresrpg/aresrpg-sdk": "4.4.2",
"@aresrpg/aresrpg-world": "1.5.1",
Expand Down
21 changes: 17 additions & 4 deletions src/core/game/custom_camera_control.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-nocheck
import { VoxelmapCollisions } from '@aresrpg/aresrpg-engine'
import CameraControls from 'camera-controls'
import { Matrix4, PerspectiveCamera, Ray, Vector3 } from 'three'
import { FrontSide, Matrix4, PerspectiveCamera, Ray, Vector3 } from 'three'

// Adapted from https://yomotsu.github.io/camera-controls/examples/collision-custom.html

Expand Down Expand Up @@ -45,9 +45,22 @@ class CustomCameraControls extends CameraControls {
const from = origin
const to = origin.clone().addScaledVector(direction, this.maxDistance)

const intersection = this.voxelmap_collisions.rayCast(from, to)
if (intersection && intersection.distance < distance) {
distance = intersection.distance // eslint-disable-line
const raycasting_result = this.voxelmap_collisions.rayIntersect(
this.#ray,
{
maxDistance: this.maxDistance,
side: FrontSide,
missingVoxels: {
considerAsBlocking: false,
},
},
)
if (
raycasting_result &&
raycasting_result.intersection &&
raycasting_result.intersection.distance < distance
) {
distance = raycasting_result.intersection.distance // eslint-disable-line
}
}

Expand Down
6 changes: 5 additions & 1 deletion src/core/modules/player_movement.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,12 @@ export default function () {
},
{
deltaTime: delta,
ascendSpeed: 20,
gravity: is_underwater ? GRAVITY_UNDERWATER : GRAVITY,
considerMissingVoxelAs: 'blocking',
missingVoxels: {
considerAsBlocking: true,
exportAsList: false,
},
},
)

Expand Down

0 comments on commit ef4d566

Please sign in to comment.