Game Development Community

Bug in Player::playFootStepSound () and others

by Stefan Lundmark · in Torque Game Engine · 09/29/2006 (8:54 am) · 4 replies

Player::playFootStepSound ()

MatrixF footMat = getTransform();

Should probably read:

MatrixF footMat = getRenderTransform();

These functions suffer from the same bug:

Player::playImpactSound ()
Player::playWaterSounds ()
Player::createSplash ()
Player::updateMove ()

#1
09/29/2006 (10:25 am)
Care to explain the difference that will make?
#2
09/29/2006 (11:00 am)
Sure.

getTransform () gets the latest transform sent by the server every tick (32 ms).
getRenderTransform () gets the latest transform interpolated by the client, every frame.

The latter sets the position of the sound to the same position as your rendered object. This is especially useful if you have a fast moving player/object, where you will hear the sound lag behind and jitter because the position is not updated at the same interval as the object position being rendered. Ie, it will not follow the player perfectly.

The topic might be slightly confusing but here is another thread:
See Why "getTransform" to position sounds
#3
09/29/2006 (11:36 am)
As long as you strictly avoid doing any calculations based on renderTransform, this sounds like a good fix to me, especially if it's getting a more desired result.

You will also want to make sure any renderTransform() uses are only being performed on the client, and only for playing purposes.
#4
09/29/2006 (12:20 pm)
Aye, good tip! Thanks.

I think it makes sense to have the sound come from the same position (the currently interpolated one) as the object that is being rendered. It might not be 100% accurate, but it is consistant to the design of the rest of the code, and you get rid of the quite annoying sounds that tries to catch up behind you when you run forward :)