spell grid sound from proper position
This commit is contained in:
parent
5eceae6e57
commit
113b1acf89
1 changed files with 7 additions and 6 deletions
|
@ -19,9 +19,10 @@ class GridSoundInstance(val player: Player) : AbstractTickableSoundInstance(HexS
|
|||
|
||||
init {
|
||||
val lookVec = player.lookAngle
|
||||
this.x = player.x + lookVec.x
|
||||
this.y = player.y + lookVec.y
|
||||
this.z = player.z + lookVec.z
|
||||
val playerPos = player.eyePosition
|
||||
this.x = playerPos.x + lookVec.x
|
||||
this.y = playerPos.y + lookVec.y
|
||||
this.z = playerPos.z + lookVec.z
|
||||
this.attenuation = SoundInstance.Attenuation.LINEAR
|
||||
this.looping = true
|
||||
this.delay = 0
|
||||
|
@ -37,10 +38,10 @@ class GridSoundInstance(val player: Player) : AbstractTickableSoundInstance(HexS
|
|||
val horizontalPlanarVector = calculateVectorFromPitchAndYaw(player.xRot + 90, player.yRot)
|
||||
val verticalPlanarVector = calculateVectorFromPitchAndYaw(player.xRot, player.yRot + 90)
|
||||
val normalVector = calculateVectorFromPitchAndYaw(player.xRot, player.yRot)
|
||||
val newPos = player.position()
|
||||
val newPos = player.eyePosition
|
||||
.add(normalVector)
|
||||
.add(horizontalPlanarVector.scale(4 * (mousePosX - 0.5)))
|
||||
.add(verticalPlanarVector.scale(4 * (mousePosY - 0.5)))
|
||||
.add(horizontalPlanarVector.scale(2 * (mousePosX - 0.5)))
|
||||
.add(verticalPlanarVector.scale(2 * (mousePosY - 0.5)))
|
||||
this.x = newPos.x
|
||||
this.y = newPos.y
|
||||
this.z = newPos.z
|
||||
|
|
Loading…
Reference in a new issue