Merge branch 'avination' into careminster

avinationmerge
Melanie 2012-05-08 00:07:13 +01:00
commit 900afbd53e
3 changed files with 46 additions and 15 deletions

View File

@ -11631,8 +11631,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
udata.scale = new Vector3(block.Data, 0); udata.scale = new Vector3(block.Data, 0);
// udata.change = ObjectChangeType.groupS; udata.change = ObjectChangeType.groupS;
udata.change = ObjectChangeType.primS; // to conform to current SL
updatehandler(localId, udata, this); updatehandler(localId, udata, this);
break; break;
@ -11643,8 +11642,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
udata.position = new Vector3(block.Data, 0); udata.position = new Vector3(block.Data, 0);
udata.scale = new Vector3(block.Data, 12); udata.scale = new Vector3(block.Data, 12);
// udata.change = ObjectChangeType.groupPS; udata.change = ObjectChangeType.groupPS;
udata.change = ObjectChangeType.primPS; // to conform to current SL
updatehandler(localId, udata, this); updatehandler(localId, udata, this);
break; break;

View File

@ -1276,9 +1276,36 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (m_parentScene.Permissions.CanEditObject(grp.UUID, remoteClient.AgentId)) if (m_parentScene.Permissions.CanEditObject(grp.UUID, remoteClient.AgentId))
{ {
// These two are exceptions SL makes in the interpretation
// of the change flags. Must check them here because otherwise
// the group flag (see below) would be lost
if (data.change == ObjectChangeType.groupS)
data.change = ObjectChangeType.primS;
if (data.change == ObjectChangeType.groupPS)
data.change = ObjectChangeType.primPS;
part.StoreUndoState(data.change); // lets test only saving what we changed part.StoreUndoState(data.change); // lets test only saving what we changed
grp.doChangeObject(part, (ObjectChangeData)data); grp.doChangeObject(part, (ObjectChangeData)data);
} }
else
{
// Is this any kind of group operation?
if ((data.change & ObjectChangeType.Group) != 0)
{
// Is a move and/or rotation requested?
if ((data.change & (ObjectChangeType.Position | ObjectChangeType.Rotation)) != 0)
{
// Are we allowed to move it?
if (m_parentScene.Permissions.CanMoveObject(grp.UUID, remoteClient.AgentId))
{
// Strip all but move and rotation from request
data.change &= (ObjectChangeType.Group | ObjectChangeType.Position | ObjectChangeType.Rotation);
part.StoreUndoState(data.change);
grp.doChangeObject(part, (ObjectChangeData)data);
}
}
}
}
} }
} }
} }

View File

@ -118,6 +118,7 @@ namespace OpenSim.Region.Physics.OdePlugin
// auxiliar // auxiliar
private float m_lmEfect = 0; // current linear motor eficiency private float m_lmEfect = 0; // current linear motor eficiency
private float m_lmDecay = 1.0f;
private float m_amEfect = 0; // current angular motor eficiency private float m_amEfect = 0; // current angular motor eficiency
private float m_ffactor = 1.0f; private float m_ffactor = 1.0f;
@ -155,6 +156,7 @@ namespace OpenSim.Region.Physics.OdePlugin
m_linearMotorDecayTimescale = vd.m_linearMotorDecayTimescale; m_linearMotorDecayTimescale = vd.m_linearMotorDecayTimescale;
if (m_linearMotorDecayTimescale < m_timestep) m_linearMotorDecayTimescale = m_timestep; if (m_linearMotorDecayTimescale < m_timestep) m_linearMotorDecayTimescale = m_timestep;
m_linearMotorDecayTimescale += 0.2f;
m_linearMotorDecayTimescale *= m_invtimestep; m_linearMotorDecayTimescale *= m_invtimestep;
m_linearMotorTimescale = vd.m_linearMotorTimescale; m_linearMotorTimescale = vd.m_linearMotorTimescale;
@ -208,6 +210,7 @@ namespace OpenSim.Region.Physics.OdePlugin
m_referenceFrame = vd.m_referenceFrame; m_referenceFrame = vd.m_referenceFrame;
m_lmEfect = 0; m_lmEfect = 0;
m_lmDecay = (1.0f - 1.0f / m_linearMotorDecayTimescale);
m_amEfect = 0; m_amEfect = 0;
m_ffactor = 1.0f; m_ffactor = 1.0f;
} }
@ -279,7 +282,7 @@ namespace OpenSim.Region.Physics.OdePlugin
case Vehicle.LINEAR_MOTOR_DECAY_TIMESCALE: case Vehicle.LINEAR_MOTOR_DECAY_TIMESCALE:
if (pValue < m_timestep) pValue = m_timestep; if (pValue < m_timestep) pValue = m_timestep;
else if (pValue > 120) pValue = 120; else if (pValue > 120) pValue = 120;
m_linearMotorDecayTimescale = pValue * m_invtimestep; m_linearMotorDecayTimescale = (0.2f +pValue) * m_invtimestep;
break; break;
case Vehicle.LINEAR_MOTOR_TIMESCALE: case Vehicle.LINEAR_MOTOR_TIMESCALE:
if (pValue < m_timestep) pValue = m_timestep; if (pValue < m_timestep) pValue = m_timestep;
@ -318,9 +321,10 @@ namespace OpenSim.Region.Physics.OdePlugin
case Vehicle.LINEAR_MOTOR_DIRECTION: case Vehicle.LINEAR_MOTOR_DIRECTION:
m_linearMotorDirection = new Vector3(pValue, pValue, pValue); m_linearMotorDirection = new Vector3(pValue, pValue, pValue);
len = m_linearMotorDirection.Length(); len = m_linearMotorDirection.Length();
if (len > 30.0f) if (len > 100.0f)
m_linearMotorDirection *= (30.0f / len); m_linearMotorDirection *= (100.0f / len);
m_lmEfect = 1.0f; // turn it on m_lmDecay = 1.0f - 1.0f / m_linearMotorDecayTimescale;
m_lmEfect = 1.0f / m_linearMotorTimescale; // turn it on
m_ffactor = 0.01f; m_ffactor = 0.01f;
if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body) if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body)
&& !rootPrim.m_isSelected && !rootPrim.m_disabled) && !rootPrim.m_isSelected && !rootPrim.m_disabled)
@ -368,9 +372,10 @@ namespace OpenSim.Region.Physics.OdePlugin
case Vehicle.LINEAR_MOTOR_DIRECTION: case Vehicle.LINEAR_MOTOR_DIRECTION:
m_linearMotorDirection = new Vector3(pValue.X, pValue.Y, pValue.Z); m_linearMotorDirection = new Vector3(pValue.X, pValue.Y, pValue.Z);
len = m_linearMotorDirection.Length(); len = m_linearMotorDirection.Length();
if (len > 30.0f) if (len > 100.0f)
m_linearMotorDirection *= (30.0f / len); m_linearMotorDirection *= (100.0f / len);
m_lmEfect = 1.0f; // turn it on m_lmDecay = 1.0f - 1.0f / m_linearMotorDecayTimescale;
m_lmEfect = 1.0f / m_linearMotorTimescale; // turn it on
m_ffactor = 0.01f; m_ffactor = 0.01f;
if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body) if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body)
&& !rootPrim.m_isSelected && !rootPrim.m_disabled) && !rootPrim.m_isSelected && !rootPrim.m_disabled)
@ -603,12 +608,13 @@ namespace OpenSim.Region.Physics.OdePlugin
// VehicleFlag.HOVER_GLOBAL_HEIGHT); // VehicleFlag.HOVER_GLOBAL_HEIGHT);
break; break;
} }
m_lmDecay = (1.0f - 1.0f / m_linearMotorDecayTimescale);
}//end SetDefaultsForType }//end SetDefaultsForType
internal void Stop() internal void Stop()
{ {
m_lmEfect = 0; m_lmEfect = 0;
m_lmDecay = 1.0f;
m_amEfect = 0; m_amEfect = 0;
m_ffactor = 1f; m_ffactor = 1f;
} }
@ -739,10 +745,10 @@ namespace OpenSim.Region.Physics.OdePlugin
Vector3 curLocalAngVel = curAngVel * irotq; // current angular velocity in local Vector3 curLocalAngVel = curAngVel * irotq; // current angular velocity in local
// linear motor // linear motor
if (m_lmEfect > 0.01 && m_linearMotorTimescale < 1000) if (m_lmEfect > 0.001 && m_linearMotorTimescale < 1000)
{ {
tmpV = m_linearMotorDirection - curLocalVel; // velocity error tmpV = m_linearMotorDirection - curLocalVel; // velocity error
tmpV *= m_lmEfect / m_linearMotorTimescale; // error to correct in this timestep tmpV *= m_lmEfect; // error to correct in this timestep
tmpV *= rotq; // to world tmpV *= rotq; // to world
if ((m_flags & VehicleFlag.LIMIT_MOTOR_UP) != 0) if ((m_flags & VehicleFlag.LIMIT_MOTOR_UP) != 0)
@ -760,7 +766,7 @@ namespace OpenSim.Region.Physics.OdePlugin
force.Y += tmpV.Y; force.Y += tmpV.Y;
force.Z += tmpV.Z; force.Z += tmpV.Z;
} }
m_lmEfect *= (1.0f - 1.0f / m_linearMotorDecayTimescale); m_lmEfect *= m_lmDecay;
m_ffactor = 0.01f + 1e-4f * curVel.LengthSquared(); m_ffactor = 0.01f + 1e-4f * curVel.LengthSquared();
} }