mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-12 19:31:41 +00:00
Fixed ShapeBase animation networking.
We essentially just need to remember to Update ShapeBase::Thread::position every time we advance the thread in the shape. With a little bit of supporting code these changes will be passed to the client's shape.
This commit is contained in:
parent
40cefe1002
commit
439dc9c56d
2 changed files with 9 additions and 16 deletions
|
|
@ -2154,13 +2154,13 @@ bool ShapeBase::setThreadSequence(U32 slot, S32 seq, bool reset)
|
|||
if (reset) {
|
||||
st.state = Thread::Play;
|
||||
st.atEnd = false;
|
||||
st.timescale = 1.f;
|
||||
st.position = 0.f;
|
||||
st.timescale = 1.f;
|
||||
st.position = 0.f;
|
||||
}
|
||||
if (mShapeInstance) {
|
||||
if (!st.thread)
|
||||
st.thread = mShapeInstance->addThread();
|
||||
mShapeInstance->setSequence(st.thread,seq,0);
|
||||
mShapeInstance->setSequence(st.thread,seq,st.position);
|
||||
updateThread(st);
|
||||
}
|
||||
return true;
|
||||
|
|
@ -2175,17 +2175,11 @@ void ShapeBase::updateThread(Thread& st)
|
|||
case Thread::Stop:
|
||||
{
|
||||
mShapeInstance->setTimeScale( st.thread, 1.f );
|
||||
mShapeInstance->setPos( st.thread, ( st.timescale > 0.f ) ? 0.0f : 1.0f );
|
||||
mShapeInstance->setPos( st.thread, ( st.timescale > 0.f ) ? 1.0f : 0.0f );
|
||||
} // Drop through to pause state
|
||||
|
||||
case Thread::Pause:
|
||||
{
|
||||
if ( st.position != -1.f )
|
||||
{
|
||||
mShapeInstance->setTimeScale( st.thread, 1.f );
|
||||
mShapeInstance->setPos( st.thread, st.position );
|
||||
}
|
||||
|
||||
mShapeInstance->setTimeScale( st.thread, 0.f );
|
||||
} break;
|
||||
|
||||
|
|
@ -2339,6 +2333,7 @@ void ShapeBase::advanceThreads(F32 dt)
|
|||
if(st.thread)
|
||||
{
|
||||
mShapeInstance->advanceTime(dt,st.thread);
|
||||
st.position = mShapeInstance->getPos(st.thread);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3039,9 +3034,9 @@ void ShapeBase::unpackUpdate(NetConnection *con, BitStream *stream)
|
|||
if (stream->readFlag()) {
|
||||
Thread& st = mScriptThread[i];
|
||||
U32 seq = stream->readInt(ThreadSequenceBits);
|
||||
st.state = stream->readInt(2);
|
||||
stream->read( &st.timescale );
|
||||
stream->read( &st.position );
|
||||
st.state = Thread::State(stream->readInt(2));
|
||||
stream->read( &st.timescale );
|
||||
stream->read( &st.position );
|
||||
st.atEnd = stream->readFlag();
|
||||
if (st.sequence != seq && st.state != Thread::Destroy)
|
||||
setThreadSequence(i,seq,false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue