remove creative hack and try to fix

avinationmerge
UbitUmarov 2014-08-13 18:52:13 +01:00
parent 3f0138c967
commit 483afe6867
1 changed files with 92 additions and 100 deletions

View File

@ -323,6 +323,8 @@ namespace OpenSim.Region.Framework.Scenes
m_group = grp; m_group = grp;
m_scene = grp.Scene; m_scene = grp.Scene;
lock (m_frames)
{
Vector3 grppos = grp.AbsolutePosition; Vector3 grppos = grp.AbsolutePosition;
Vector3 offset = grppos - m_serializedPosition; Vector3 offset = grppos - m_serializedPosition;
// avoid doing it more than once // avoid doing it more than once
@ -340,6 +342,7 @@ namespace OpenSim.Region.Framework.Scenes
k.Position += offset; k.Position += offset;
m_frames[i] = k; m_frames[i] = k;
} }
}
if (m_running) if (m_running)
Start(); Start();
@ -383,6 +386,8 @@ namespace OpenSim.Region.Framework.Scenes
m_keyframes.CopyTo(newmotion.m_keyframes, 0); m_keyframes.CopyTo(newmotion.m_keyframes, 0);
} }
lock (m_frames)
{
newmotion.m_frames = new List<Keyframe>(m_frames); newmotion.m_frames = new List<Keyframe>(m_frames);
newmotion.m_basePosition = m_basePosition; newmotion.m_basePosition = m_basePosition;
@ -402,6 +407,7 @@ namespace OpenSim.Region.Framework.Scenes
newmotion.m_iterations = m_iterations; newmotion.m_iterations = m_iterations;
newmotion.m_running = m_running; newmotion.m_running = m_running;
}
if (m_running && !m_waitingCrossing) if (m_running && !m_waitingCrossing)
StartTimer(); StartTimer();
@ -520,7 +526,6 @@ namespace OpenSim.Region.Framework.Scenes
k.Position = pos; k.Position = pos;
// k.Velocity = Vector3.Zero; // k.Velocity = Vector3.Zero;
} }
k.AngularVelocity = (Vector3)k.Position;
k.StartRotation = rot; k.StartRotation = rot;
if (k.Rotation.HasValue) if (k.Rotation.HasValue)
@ -653,6 +658,8 @@ namespace OpenSim.Region.Framework.Scenes
} }
if (m_frames.Count == 0) if (m_frames.Count == 0)
{
lock (m_frames)
{ {
GetNextList(); GetNextList();
@ -674,7 +681,7 @@ namespace OpenSim.Region.Framework.Scenes
m_currentFrame = m_frames[0]; m_currentFrame = m_frames[0];
m_currentFrame.TimeMS += (int)tickDuration; m_currentFrame.TimeMS += (int)tickDuration;
}
//force a update on a keyframe transition //force a update on a keyframe transition
update = true; update = true;
} }
@ -689,16 +696,20 @@ namespace OpenSim.Region.Framework.Scenes
m_group.RootPart.Velocity = Vector3.Zero; m_group.RootPart.Velocity = Vector3.Zero;
m_group.RootPart.AngularVelocity = Vector3.Zero; m_group.RootPart.AngularVelocity = Vector3.Zero;
m_nextPosition = NormalizeVector(m_currentFrame.AngularVelocity); m_nextPosition = (Vector3)m_currentFrame.Position;
m_group.AbsolutePosition = m_nextPosition; m_group.AbsolutePosition = m_nextPosition;
// we are sending imediate updates, no doing force a extra terseUpdate // we are sending imediate updates, no doing force a extra terseUpdate
// m_group.UpdateGroupRotationR((Quaternion)m_currentFrame.Rotation); // m_group.UpdateGroupRotationR((Quaternion)m_currentFrame.Rotation);
m_group.RootPart.RotationOffset = (Quaternion)m_currentFrame.Rotation; m_group.RootPart.RotationOffset = (Quaternion)m_currentFrame.Rotation;
lock (m_frames)
{
m_frames.RemoveAt(0); m_frames.RemoveAt(0);
if (m_frames.Count > 0) if (m_frames.Count > 0)
m_currentFrame = m_frames[0]; m_currentFrame = m_frames[0];
}
update = true; update = true;
} }
@ -714,7 +725,6 @@ namespace OpenSim.Region.Framework.Scenes
{ {
// m_group.AbsolutePosition += motionThisFrame; // m_group.AbsolutePosition += motionThisFrame;
m_nextPosition = m_group.AbsolutePosition + motionThisFrame; m_nextPosition = m_group.AbsolutePosition + motionThisFrame;
m_group.AbsolutePosition = m_nextPosition;
//m_group.RootPart.Velocity = v; //m_group.RootPart.Velocity = v;
update = true; update = true;
@ -773,29 +783,11 @@ namespace OpenSim.Region.Framework.Scenes
if (update) if (update)
{ {
m_group.AbsolutePosition = m_nextPosition;
m_group.SendGroupRootTerseUpdate(); m_group.SendGroupRootTerseUpdate();
} }
} }
private Vector3 NormalizeVector(Vector3? pPosition)
{
if (pPosition == null)
return Vector3.Zero;
Vector3 tmp = (Vector3) pPosition;
while (tmp.X > Constants.RegionSize)
tmp.X -= Constants.RegionSize;
while (tmp.X < 0)
tmp.X += Constants.RegionSize;
while (tmp.Y > Constants.RegionSize)
tmp.Y -= Constants.RegionSize;
while (tmp.Y < 0)
tmp.Y += Constants.RegionSize;
return tmp;
}
public Byte[] Serialize() public Byte[] Serialize()
{ {
StopTimer(); StopTimer();