* Some more ApplyPhysics voodoo
parent
a553e6f67c
commit
c1fdba8a6f
|
@ -247,6 +247,8 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
AttachToBackup();
|
AttachToBackup();
|
||||||
|
|
||||||
|
ApplyPhysics();
|
||||||
|
|
||||||
ScheduleGroupForFullUpdate();
|
ScheduleGroupForFullUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,7 +283,6 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
part.RegionHandle = m_regionHandle;
|
part.RegionHandle = m_regionHandle;
|
||||||
|
|
||||||
part.ApplyPermissions();
|
part.ApplyPermissions();
|
||||||
part.ApplyPhysics();
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case XmlNodeType.EndElement:
|
case XmlNodeType.EndElement:
|
||||||
|
@ -291,7 +292,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
reader.Close();
|
reader.Close();
|
||||||
sr.Close();
|
sr.Close();
|
||||||
|
|
||||||
AddPart( m_rootPart );
|
AddPart(m_rootPart);
|
||||||
|
|
||||||
m_rootPart.LocalID = m_scene.PrimIDAllocate();
|
m_rootPart.LocalID = m_scene.PrimIDAllocate();
|
||||||
m_rootPart.ParentID = 0;
|
m_rootPart.ParentID = 0;
|
||||||
|
@ -300,6 +301,8 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
AttachToBackup();
|
AttachToBackup();
|
||||||
|
|
||||||
|
ApplyPhysics();
|
||||||
|
|
||||||
ScheduleGroupForFullUpdate();
|
ScheduleGroupForFullUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,11 +373,11 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
foreach (SceneObjectPart part in m_parts.Values)
|
foreach (SceneObjectPart part in m_parts.Values)
|
||||||
{
|
{
|
||||||
|
|
||||||
Vector3 partPosition = new Vector3(part.AbsolutePosition.X,part.AbsolutePosition.Y,part.AbsolutePosition.Z);
|
Vector3 partPosition = new Vector3(part.AbsolutePosition.X, part.AbsolutePosition.Y, part.AbsolutePosition.Z);
|
||||||
Quaternion parentrotation = new Quaternion(GroupRotation.W,GroupRotation.X,GroupRotation.Y,GroupRotation.Z);
|
Quaternion parentrotation = new Quaternion(GroupRotation.W, GroupRotation.X, GroupRotation.Y, GroupRotation.Z);
|
||||||
|
|
||||||
// Telling the prim to raytrace.
|
// Telling the prim to raytrace.
|
||||||
EntityIntersection inter = part.TestIntersection(hRay,parentrotation);
|
EntityIntersection inter = part.TestIntersection(hRay, parentrotation);
|
||||||
|
|
||||||
// This may need to be updated to the maximum draw distance possible..
|
// This may need to be updated to the maximum draw distance possible..
|
||||||
// We might (and probably will) be checking for prim creation from other sims
|
// We might (and probably will) be checking for prim creation from other sims
|
||||||
|
@ -384,9 +387,11 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (inter.HitTF) {
|
if (inter.HitTF)
|
||||||
|
{
|
||||||
// We need to find the closest prim to return to the testcaller along the ray
|
// We need to find the closest prim to return to the testcaller along the ray
|
||||||
if (inter.distance < idist) {
|
if (inter.distance < idist)
|
||||||
|
{
|
||||||
|
|
||||||
idist = inter.distance;
|
idist = inter.distance;
|
||||||
returnresult.HitTF = true;
|
returnresult.HitTF = true;
|
||||||
|
@ -429,6 +434,8 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
SetPartAsRoot(newPart);
|
SetPartAsRoot(newPart);
|
||||||
|
|
||||||
AttachToBackup();
|
AttachToBackup();
|
||||||
|
|
||||||
|
ApplyPhysics();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -512,7 +519,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public SceneObjectGroup Copy(LLUUID cAgentID, LLUUID cGroupID)
|
public SceneObjectGroup Copy(LLUUID cAgentID, LLUUID cGroupID)
|
||||||
{
|
{
|
||||||
SceneObjectGroup dupe = (SceneObjectGroup) MemberwiseClone();
|
SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone();
|
||||||
dupe.m_parts = new Dictionary<LLUUID, SceneObjectPart>();
|
dupe.m_parts = new Dictionary<LLUUID, SceneObjectPart>();
|
||||||
dupe.m_parts.Clear();
|
dupe.m_parts.Clear();
|
||||||
//dupe.OwnerID = AgentID;
|
//dupe.OwnerID = AgentID;
|
||||||
|
@ -554,7 +561,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
if (part.UUID != m_rootPart.UUID)
|
if (part.UUID != m_rootPart.UUID)
|
||||||
{
|
{
|
||||||
dupe.CopyPart(part,OwnerID, GroupID);
|
dupe.CopyPart(part, OwnerID, GroupID);
|
||||||
SetPartOwner(part, cAgentID, cGroupID);
|
SetPartOwner(part, cAgentID, cGroupID);
|
||||||
part.ScheduleFullUpdate();
|
part.ScheduleFullUpdate();
|
||||||
|
|
||||||
|
@ -579,7 +586,8 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
m_parts.Add(newPart.UUID, newPart);
|
m_parts.Add(newPart.UUID, newPart);
|
||||||
SetPartAsRoot(newPart);
|
SetPartAsRoot(newPart);
|
||||||
}
|
}
|
||||||
public void SetRootPartOwner(SceneObjectPart part, LLUUID cAgentID, LLUUID cGroupID) {
|
public void SetRootPartOwner(SceneObjectPart part, LLUUID cAgentID, LLUUID cGroupID)
|
||||||
|
{
|
||||||
part.LastOwnerID = part.OwnerID;
|
part.LastOwnerID = part.OwnerID;
|
||||||
part.OwnerID = cAgentID;
|
part.OwnerID = cAgentID;
|
||||||
part.GroupID = cGroupID;
|
part.GroupID = cGroupID;
|
||||||
|
@ -613,7 +621,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="part"></param>
|
/// <param name="part"></param>
|
||||||
public void ServiceObjectPropertiesFamilyRequest(IClientAPI remoteClient,LLUUID AgentID, uint RequestFlags)
|
public void ServiceObjectPropertiesFamilyRequest(IClientAPI remoteClient, LLUUID AgentID, uint RequestFlags)
|
||||||
{
|
{
|
||||||
//RootPart.ServiceObjectPropertiesFamilyRequest(remoteClient, AgentID, RequestFlags);
|
//RootPart.ServiceObjectPropertiesFamilyRequest(remoteClient, AgentID, RequestFlags);
|
||||||
ObjectPropertiesFamilyPacket objPropFamilyPack = new ObjectPropertiesFamilyPacket();
|
ObjectPropertiesFamilyPacket objPropFamilyPack = new ObjectPropertiesFamilyPacket();
|
||||||
|
@ -839,12 +847,12 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
Quaternion parentRot =
|
Quaternion parentRot =
|
||||||
new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
|
new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
|
||||||
m_rootPart.RotationOffset.Z);
|
m_rootPart.RotationOffset.Z);
|
||||||
axPos = parentRot.Inverse()*axPos;
|
axPos = parentRot.Inverse() * axPos;
|
||||||
linkPart.OffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z);
|
linkPart.OffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z);
|
||||||
Quaternion oldRot =
|
Quaternion oldRot =
|
||||||
new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X, linkPart.RotationOffset.Y,
|
new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X, linkPart.RotationOffset.Y,
|
||||||
linkPart.RotationOffset.Z);
|
linkPart.RotationOffset.Z);
|
||||||
Quaternion newRot = parentRot.Inverse()*oldRot;
|
Quaternion newRot = parentRot.Inverse() * oldRot;
|
||||||
linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w);
|
linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w);
|
||||||
linkPart.ParentID = m_rootPart.LocalID;
|
linkPart.ParentID = m_rootPart.LocalID;
|
||||||
m_parts.Add(linkPart.UUID, linkPart);
|
m_parts.Add(linkPart.UUID, linkPart);
|
||||||
|
@ -961,7 +969,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
m_parts.Add(part.UUID, part);
|
m_parts.Add(part.UUID, part);
|
||||||
|
|
||||||
Vector3 axiomOldPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z);
|
Vector3 axiomOldPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z);
|
||||||
axiomOldPos = oldGroupRotation*axiomOldPos;
|
axiomOldPos = oldGroupRotation * axiomOldPos;
|
||||||
axiomOldPos += oldGroupPosition;
|
axiomOldPos += oldGroupPosition;
|
||||||
LLVector3 oldAbsolutePosition = new LLVector3(axiomOldPos.x, axiomOldPos.y, axiomOldPos.z);
|
LLVector3 oldAbsolutePosition = new LLVector3(axiomOldPos.x, axiomOldPos.y, axiomOldPos.z);
|
||||||
part.OffsetPosition = oldAbsolutePosition - AbsolutePosition;
|
part.OffsetPosition = oldAbsolutePosition - AbsolutePosition;
|
||||||
|
@ -971,15 +979,15 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
m_rootPart.RotationOffset.Z);
|
m_rootPart.RotationOffset.Z);
|
||||||
|
|
||||||
Vector3 axiomPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z);
|
Vector3 axiomPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z);
|
||||||
axiomPos = axiomRootRotation.Inverse()*axiomPos;
|
axiomPos = axiomRootRotation.Inverse() * axiomPos;
|
||||||
part.OffsetPosition = new LLVector3(axiomPos.x, axiomPos.y, axiomPos.z);
|
part.OffsetPosition = new LLVector3(axiomPos.x, axiomPos.y, axiomPos.z);
|
||||||
|
|
||||||
Quaternion axiomPartRotation =
|
Quaternion axiomPartRotation =
|
||||||
new Quaternion(part.RotationOffset.W, part.RotationOffset.X, part.RotationOffset.Y,
|
new Quaternion(part.RotationOffset.W, part.RotationOffset.X, part.RotationOffset.Y,
|
||||||
part.RotationOffset.Z);
|
part.RotationOffset.Z);
|
||||||
|
|
||||||
axiomPartRotation = oldGroupRotation*axiomPartRotation;
|
axiomPartRotation = oldGroupRotation * axiomPartRotation;
|
||||||
axiomPartRotation = axiomRootRotation.Inverse()*axiomPartRotation;
|
axiomPartRotation = axiomRootRotation.Inverse() * axiomPartRotation;
|
||||||
part.RotationOffset =
|
part.RotationOffset =
|
||||||
new LLQuaternion(axiomPartRotation.x, axiomPartRotation.y, axiomPartRotation.z, axiomPartRotation.w);
|
new LLQuaternion(axiomPartRotation.x, axiomPartRotation.y, axiomPartRotation.z, axiomPartRotation.w);
|
||||||
}
|
}
|
||||||
|
@ -1009,12 +1017,12 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1];
|
proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1];
|
||||||
proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock();
|
proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock();
|
||||||
proper.ObjectData[0].ItemID = LLUUID.Zero;
|
proper.ObjectData[0].ItemID = LLUUID.Zero;
|
||||||
proper.ObjectData[0].CreationDate = (ulong) m_rootPart.CreationDate;
|
proper.ObjectData[0].CreationDate = (ulong)m_rootPart.CreationDate;
|
||||||
proper.ObjectData[0].CreatorID = m_rootPart.CreatorID;
|
proper.ObjectData[0].CreatorID = m_rootPart.CreatorID;
|
||||||
proper.ObjectData[0].FolderID = LLUUID.Zero;
|
proper.ObjectData[0].FolderID = LLUUID.Zero;
|
||||||
proper.ObjectData[0].FromTaskID = LLUUID.Zero;
|
proper.ObjectData[0].FromTaskID = LLUUID.Zero;
|
||||||
proper.ObjectData[0].GroupID = LLUUID.Zero;
|
proper.ObjectData[0].GroupID = LLUUID.Zero;
|
||||||
proper.ObjectData[0].InventorySerial = (short) m_rootPart.InventorySerial;
|
proper.ObjectData[0].InventorySerial = (short)m_rootPart.InventorySerial;
|
||||||
proper.ObjectData[0].LastOwnerID = m_rootPart.LastOwnerID;
|
proper.ObjectData[0].LastOwnerID = m_rootPart.LastOwnerID;
|
||||||
proper.ObjectData[0].ObjectID = UUID;
|
proper.ObjectData[0].ObjectID = UUID;
|
||||||
proper.ObjectData[0].OwnerID = m_rootPart.OwnerID;
|
proper.ObjectData[0].OwnerID = m_rootPart.OwnerID;
|
||||||
|
@ -1329,7 +1337,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
Quaternion partRotation =
|
Quaternion partRotation =
|
||||||
new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
|
new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
|
||||||
m_rootPart.RotationOffset.Z);
|
m_rootPart.RotationOffset.Z);
|
||||||
axDiff = partRotation.Inverse()*axDiff;
|
axDiff = partRotation.Inverse() * axDiff;
|
||||||
diff.X = axDiff.x;
|
diff.X = axDiff.x;
|
||||||
diff.Y = axDiff.y;
|
diff.Y = axDiff.y;
|
||||||
diff.Z = axDiff.z;
|
diff.Z = axDiff.z;
|
||||||
|
@ -1431,14 +1439,14 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
if (prim.UUID != m_rootPart.UUID)
|
if (prim.UUID != m_rootPart.UUID)
|
||||||
{
|
{
|
||||||
Vector3 axPos = new Vector3(prim.OffsetPosition.X, prim.OffsetPosition.Y, prim.OffsetPosition.Z);
|
Vector3 axPos = new Vector3(prim.OffsetPosition.X, prim.OffsetPosition.Y, prim.OffsetPosition.Z);
|
||||||
axPos = oldParentRot*axPos;
|
axPos = oldParentRot * axPos;
|
||||||
axPos = axRot.Inverse()*axPos;
|
axPos = axRot.Inverse() * axPos;
|
||||||
prim.OffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z);
|
prim.OffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z);
|
||||||
Quaternion primsRot =
|
Quaternion primsRot =
|
||||||
new Quaternion(prim.RotationOffset.W, prim.RotationOffset.X, prim.RotationOffset.Y,
|
new Quaternion(prim.RotationOffset.W, prim.RotationOffset.X, prim.RotationOffset.Y,
|
||||||
prim.RotationOffset.Z);
|
prim.RotationOffset.Z);
|
||||||
Quaternion newRot = oldParentRot*primsRot;
|
Quaternion newRot = oldParentRot * primsRot;
|
||||||
newRot = axRot.Inverse()*newRot;
|
newRot = axRot.Inverse() * newRot;
|
||||||
prim.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w);
|
prim.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w);
|
||||||
prim.ScheduleTerseUpdate();
|
prim.ScheduleTerseUpdate();
|
||||||
}
|
}
|
||||||
|
@ -1670,7 +1678,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
public override void SetText(string text, Vector3 color, double alpha)
|
public override void SetText(string text, Vector3 color, double alpha)
|
||||||
{
|
{
|
||||||
Color = Color.FromArgb (0xff - (int)(alpha * 0xff),
|
Color = Color.FromArgb(0xff - (int)(alpha * 0xff),
|
||||||
(int)(color.x * 0xff),
|
(int)(color.x * 0xff),
|
||||||
(int)(color.y * 0xff),
|
(int)(color.y * 0xff),
|
||||||
(int)(color.z * 0xff));
|
(int)(color.z * 0xff));
|
||||||
|
@ -1679,10 +1687,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
public void ApplyPhysics()
|
public void ApplyPhysics()
|
||||||
{
|
{
|
||||||
foreach(SceneObjectPart part in m_parts.Values )
|
m_rootPart.ApplyPhysics();
|
||||||
{
|
|
||||||
part.ApplyPhysics();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -473,7 +473,6 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
LLObject.ObjectFlags.ObjectOwnerModify;
|
LLObject.ObjectFlags.ObjectOwnerModify;
|
||||||
|
|
||||||
ApplyPermissions();
|
ApplyPermissions();
|
||||||
ApplyPhysics();
|
|
||||||
|
|
||||||
ScheduleFullUpdate();
|
ScheduleFullUpdate();
|
||||||
}
|
}
|
||||||
|
@ -512,7 +511,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
ObjectFlags = flags;
|
ObjectFlags = flags;
|
||||||
|
|
||||||
ApplyPermissions();
|
ApplyPermissions();
|
||||||
ApplyPhysics();
|
// ApplyPhysics();
|
||||||
|
|
||||||
ScheduleFullUpdate();
|
ScheduleFullUpdate();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue