vehicle issues - ctrl x not working and wheel animation stopping - RESOLVED
by Alan James · in Torque 3D Professional · 02/15/2010 (1:50 pm) · 9 replies
The key bind "ctrl x" seems to be not functioning as of 1.1b. Have not tried binding to any other key combination.
Also, the wheel animations stop if you "alt c" into camera mode, fly around a bit and then "alt c" back into the vehicle. This happens on the original buggy and custom vehicle models.
Also, the wheel animations stop if you "alt c" into camera mode, fly around a bit and then "alt c" back into the vehicle. This happens on the original buggy and custom vehicle models.
About the author
#2
07/14/2010 (3:23 am)
Logged: TQA-570
#3
07/14/2010 (4:50 am)
The key bind "ctrl x" works for me.
#4
Wow, this was a tough one to hunt down. It had nothing to do with vehicles in the end, and would affect any object that the Player class could control that relies on advanceTime() for client-side effects.
What would happen is when you switch the GameConnection's object that is being controlled from something like the camera, back to the Player (happens in GameConntrion::readPacket()), the Player's readPacketData() gets called to sync things back up with the client. Within Player::readPacketData() the object being controlled by the Player is again set, which in the case of this thread is a WheeledVehicle.
When Player::setControlObject() is called, it clears out the old control object and adds the new one. Behind the scenes this calls SceneObject::setProcessTick() on the controlled object and fiddles with how the object's processTick(), interpolateTick() and advanceTime() are called.
Unfortunately, when you clear the control object and then set it back to the same object right away, advanceTime() for the control object (WheeledVehicle here) gets pulled out of the process link list and ends up not being called any more. IIRC the right combination for this to happen is the control object also needs to be mounted by the Player. For WheeledVehicle, this means no wheel or shock animation.
When the Player dismounts, the Player's control object is cleared and with the mount also gone, the WheeledVehicle is correctly added back to the process list.
Whew! Now for the crazy fix. At the top of Player::setControlObject() add the following:
And that's it! This fix is now in place for the next release of T3D.
- Dave
01/28/2011 (10:01 am)
Greetings!Wow, this was a tough one to hunt down. It had nothing to do with vehicles in the end, and would affect any object that the Player class could control that relies on advanceTime() for client-side effects.
What would happen is when you switch the GameConnection's object that is being controlled from something like the camera, back to the Player (happens in GameConntrion::readPacket()), the Player's readPacketData() gets called to sync things back up with the client. Within Player::readPacketData() the object being controlled by the Player is again set, which in the case of this thread is a WheeledVehicle.
When Player::setControlObject() is called, it clears out the old control object and adds the new one. Behind the scenes this calls SceneObject::setProcessTick() on the controlled object and fiddles with how the object's processTick(), interpolateTick() and advanceTime() are called.
Unfortunately, when you clear the control object and then set it back to the same object right away, advanceTime() for the control object (WheeledVehicle here) gets pulled out of the process link list and ends up not being called any more. IIRC the right combination for this to happen is the control object also needs to be mounted by the Player. For WheeledVehicle, this means no wheel or shock animation.
When the Player dismounts, the Player's control object is cleared and with the mount also gone, the WheeledVehicle is correctly added back to the process list.
Whew! Now for the crazy fix. At the top of Player::setControlObject() add the following:
if (mControlObject == obj)
return;And that's it! This fix is now in place for the next release of T3D.
- Dave
#6
Well...yes, it is. Looks like the ticket was pointing to this thread instead of the correct one. Too bad. I could have just used your fix and saved some time. :P
Thanks!
- Dave
01/28/2011 (12:00 pm)
Hey Bank.Well...yes, it is. Looks like the ticket was pointing to this thread instead of the correct one. Too bad. I could have just used your fix and saved some time. :P
Thanks!
- Dave
#7
01/28/2011 (12:07 pm)
hehe, yeah, i know, that "easy" fix took some time on debugging for me too, so I know what you mean :)
#8
04/14/2011 (5:26 pm)
Fixed in 1.1 Final and Preview.
#9
04/15/2011 (4:42 am)
Yay....
Torque Owner Henry Todd
Atomic Walrus