Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
action: () => {
const position = this.character.location;
let speed = environment.movement.walkingSpeed;
if (this.character.state === MeModelState.RUNNING) {
speed = environment.movement.runningSpeed;
}
if (this.character.isCrawling) {
speed = environment.movement.crawlingSpeed;
}
const nextLocation = GeoUtilsService.pointByLocationDistanceAndAzimuth(
position,
speed,
Cesium.Math.toRadians(this.character.heading + delta),
true
);
if (this.character.enteredBuilding) {
if (!this.collisionDetector.detectCollision(nextLocation, true)) {
this.character.location = nextLocation;
}
}
else if (direction !== MoveDirection.Forward) {
this.character.location = nextLocation;
if (this.collisionDetector.collision) {
this.collisionDetector.detectCollision(nextLocation, true);
}
}