Game Development Community

Detecting Footstep Triggers on the Server

by Robert Brower · in Torque Game Engine · 11/03/2007 (3:54 am) · 2 replies

Imagine you're making a golf game. You've given your golfer a swing animation. In this animation you've used the footstep trigger to signal when the club is going to hit the ball. You want to play a sound ~and~ apply an impulse to an object such as the golf ball. The sound of the club hitting the ball should probably be on the client just as the footstep sounds are. But I am having trouble realizing how to detect the trigger on the server so as to execute the console function that will act upon the object the golfer is swinging at, i.e. the ball. And it brings up a second question which is how synchronized with the impulse applied to the ball be with the sound of the club hitting the ball on the client. Can anyone help point me in the right direction? Thank you!

Robert

#1
11/04/2007 (9:19 am)
@Robert - You would have to make sure that the server plays that animation. The server typically doesn't play many of the Player class animations. If i remember correctly only the recoil and look animations are played on the server. You either need to hack in your swing as one of these or change the C++ code to do what you want.
#2
11/05/2007 (12:53 am)
Thanks Tom. I'm not sure I fully understand you... yet. Take for example, the action animations or cell animations. The server calls the console function onAnimationDone() when those are complete. Armed with that I added a check in ::updateMove() that checks that the object is not a ghost then calls the console function onHitBall() and it seems to work. I even enclosed the call in an if(isServerObject()) and it still calls the console function when the trigger is triggered. I guess I need to do more testing to see if everything is working as I hope.