Skip to content

Commit

Permalink
Merge pull request #15 from Crazy-Cow/CD-53
Browse files Browse the repository at this point in the history
Fix: characters can't stop
  • Loading branch information
seven05 authored Nov 14, 2024
2 parents 56c90a9 + dd0dbd3 commit 955da6e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/app_cannon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,13 @@ io.on('connection', (socket: Socket) => {
character.cannonBody.velocity.x = targetVelocityX
character.cannonBody.velocity.z = targetVelocityZ

// 키가 떼어진 상태라면 속도를 완전히 0으로 설정
if (targetVelocityX === 0 && targetVelocityZ === 0) {
character.cannonBody.velocity.x = 0
character.cannonBody.velocity.z = 0
character.cannonBody.angularVelocity.set(0, 0, 0) // 각속도도 0으로 설정
}

const facingAngleRad = Math.atan2(
character.cannonBody.velocity.x,
character.cannonBody.velocity.z
Expand Down

0 comments on commit 955da6e

Please sign in to comment.