auto-git:
[change] src/runtime-three/third-person-navigation-controller.ts
This commit is contained in:
@@ -924,21 +924,51 @@ export class ThirdPersonNavigationController implements NavigationController {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.climbSurface = activeSurface;
|
|
||||||
|
|
||||||
const climbMovement = computeClimbPlaneMovement({
|
const climbMovement = computeClimbPlaneMovement({
|
||||||
normal: activeSurface.normal,
|
normal: activeSurface.normal,
|
||||||
input: inputState,
|
input: inputState,
|
||||||
speedMetersPerSecond: CLIMB_SPEED_METERS_PER_SECOND,
|
speedMetersPerSecond: CLIMB_SPEED_METERS_PER_SECOND,
|
||||||
dt
|
dt
|
||||||
});
|
});
|
||||||
|
const climbTopOutAssist =
|
||||||
|
playerMovement.edgeAssist.enabled && climbMovement.motion.y > 0
|
||||||
|
? resolvePlayerEdgeAssistTopOut({
|
||||||
|
feetPosition: this.feetPosition,
|
||||||
|
shape: this.standingPlayerShape,
|
||||||
|
direction: {
|
||||||
|
x: -activeSurface.normal.x,
|
||||||
|
y: 0,
|
||||||
|
z: -activeSurface.normal.z
|
||||||
|
},
|
||||||
|
pushToTopHeight: playerMovement.edgeAssist.pushToTopHeight,
|
||||||
|
canOccupyShape: (feetPosition, shape) =>
|
||||||
|
this.context?.canOccupyPlayerShape?.(feetPosition, shape) ??
|
||||||
|
true,
|
||||||
|
probeGround: (feetPosition, shape, maxDistance) =>
|
||||||
|
this.context?.probePlayerGround?.(
|
||||||
|
feetPosition,
|
||||||
|
shape,
|
||||||
|
maxDistance
|
||||||
|
) ?? {
|
||||||
|
grounded: false,
|
||||||
|
distance: null,
|
||||||
|
normal: null,
|
||||||
|
slopeDegrees: null
|
||||||
|
}
|
||||||
|
})
|
||||||
|
: null;
|
||||||
|
this.climbSurface = climbTopOutAssist === null ? activeSurface : null;
|
||||||
|
|
||||||
const resolvedMotion =
|
const resolvedMotion =
|
||||||
this.context.resolveFirstPersonMotion(
|
climbTopOutAssist === null
|
||||||
|
? (this.context.resolveFirstPersonMotion(
|
||||||
this.feetPosition,
|
this.feetPosition,
|
||||||
climbMovement.motion,
|
climbMovement.motion,
|
||||||
this.standingPlayerShape
|
this.standingPlayerShape
|
||||||
) ?? null;
|
) ?? null)
|
||||||
|
: null;
|
||||||
const nextFeetPosition =
|
const nextFeetPosition =
|
||||||
|
climbTopOutAssist?.feetPosition ??
|
||||||
resolvedMotion?.feetPosition ?? {
|
resolvedMotion?.feetPosition ?? {
|
||||||
x: this.feetPosition.x + climbMovement.motion.x,
|
x: this.feetPosition.x + climbMovement.motion.x,
|
||||||
y: this.feetPosition.y + climbMovement.motion.y,
|
y: this.feetPosition.y + climbMovement.motion.y,
|
||||||
@@ -963,11 +993,13 @@ export class ThirdPersonNavigationController implements NavigationController {
|
|||||||
this.latestJumpStarted = false;
|
this.latestJumpStarted = false;
|
||||||
this.latestHeadBump = false;
|
this.latestHeadBump = false;
|
||||||
this.previousPlanarDisplacement = displacement;
|
this.previousPlanarDisplacement = displacement;
|
||||||
this.grounded = false;
|
this.grounded = climbTopOutAssist !== null;
|
||||||
this.inWaterVolume = volumeState.inWater;
|
this.inWaterVolume = volumeState.inWater;
|
||||||
this.inFogVolume = volumeState.inFog;
|
this.inFogVolume = volumeState.inFog;
|
||||||
this.smoothedFeetY = this.feetPosition.y;
|
this.smoothedFeetY = this.feetPosition.y;
|
||||||
this.locomotionState = this.createClimbingLocomotionState({
|
this.locomotionState =
|
||||||
|
climbTopOutAssist === null
|
||||||
|
? this.createClimbingLocomotionState({
|
||||||
inputMagnitude: climbMovement.inputMagnitude,
|
inputMagnitude: climbMovement.inputMagnitude,
|
||||||
displacement,
|
displacement,
|
||||||
dt,
|
dt,
|
||||||
@@ -977,7 +1009,17 @@ export class ThirdPersonNavigationController implements NavigationController {
|
|||||||
y: false,
|
y: false,
|
||||||
z: false
|
z: false
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
: {
|
||||||
|
...createIdleRuntimeLocomotionState("grounded"),
|
||||||
|
gait: "walk",
|
||||||
|
inputMagnitude: climbMovement.inputMagnitude,
|
||||||
|
requestedPlanarSpeed: CLIMB_SPEED_METERS_PER_SECOND,
|
||||||
|
planarSpeed:
|
||||||
|
dt > 0
|
||||||
|
? Math.hypot(displacement.x, displacement.z) / dt
|
||||||
|
: 0
|
||||||
|
};
|
||||||
|
|
||||||
this.updateCameraTransform(dt);
|
this.updateCameraTransform(dt);
|
||||||
this.publishTelemetry();
|
this.publishTelemetry();
|
||||||
|
|||||||
Reference in New Issue
Block a user