* Some more ApplyPhysics voodoo

afrisby
lbsa71 2007-12-04 16:41:20 +00:00
parent a553e6f67c
commit c1fdba8a6f
2 changed files with 88 additions and 84 deletions

View File

@ -247,6 +247,8 @@ namespace OpenSim.Region.Environment.Scenes
AttachToBackup();
ApplyPhysics();
ScheduleGroupForFullUpdate();
}
@ -281,7 +283,6 @@ namespace OpenSim.Region.Environment.Scenes
part.RegionHandle = m_regionHandle;
part.ApplyPermissions();
part.ApplyPhysics();
}
break;
case XmlNodeType.EndElement:
@ -291,7 +292,7 @@ namespace OpenSim.Region.Environment.Scenes
reader.Close();
sr.Close();
AddPart( m_rootPart );
AddPart(m_rootPart);
m_rootPart.LocalID = m_scene.PrimIDAllocate();
m_rootPart.ParentID = 0;
@ -300,6 +301,8 @@ namespace OpenSim.Region.Environment.Scenes
AttachToBackup();
ApplyPhysics();
ScheduleGroupForFullUpdate();
}
@ -370,11 +373,11 @@ namespace OpenSim.Region.Environment.Scenes
foreach (SceneObjectPart part in m_parts.Values)
{
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);
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);
// 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..
// 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
if (inter.distance < idist) {
if (inter.distance < idist)
{
idist = inter.distance;
returnresult.HitTF = true;
@ -429,6 +434,8 @@ namespace OpenSim.Region.Environment.Scenes
SetPartAsRoot(newPart);
AttachToBackup();
ApplyPhysics();
}
/// <summary>
@ -512,7 +519,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <returns></returns>
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.Clear();
//dupe.OwnerID = AgentID;
@ -554,7 +561,7 @@ namespace OpenSim.Region.Environment.Scenes
{
if (part.UUID != m_rootPart.UUID)
{
dupe.CopyPart(part,OwnerID, GroupID);
dupe.CopyPart(part, OwnerID, GroupID);
SetPartOwner(part, cAgentID, cGroupID);
part.ScheduleFullUpdate();
@ -579,7 +586,8 @@ namespace OpenSim.Region.Environment.Scenes
m_parts.Add(newPart.UUID, 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.OwnerID = cAgentID;
part.GroupID = cGroupID;
@ -613,7 +621,7 @@ namespace OpenSim.Region.Environment.Scenes
///
/// </summary>
/// <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);
ObjectPropertiesFamilyPacket objPropFamilyPack = new ObjectPropertiesFamilyPacket();
@ -839,12 +847,12 @@ namespace OpenSim.Region.Environment.Scenes
Quaternion parentRot =
new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
m_rootPart.RotationOffset.Z);
axPos = parentRot.Inverse()*axPos;
axPos = parentRot.Inverse() * axPos;
linkPart.OffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z);
Quaternion oldRot =
new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X, linkPart.RotationOffset.Y,
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.ParentID = m_rootPart.LocalID;
m_parts.Add(linkPart.UUID, linkPart);
@ -961,7 +969,7 @@ namespace OpenSim.Region.Environment.Scenes
m_parts.Add(part.UUID, part);
Vector3 axiomOldPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z);
axiomOldPos = oldGroupRotation*axiomOldPos;
axiomOldPos = oldGroupRotation * axiomOldPos;
axiomOldPos += oldGroupPosition;
LLVector3 oldAbsolutePosition = new LLVector3(axiomOldPos.x, axiomOldPos.y, axiomOldPos.z);
part.OffsetPosition = oldAbsolutePosition - AbsolutePosition;
@ -971,15 +979,15 @@ namespace OpenSim.Region.Environment.Scenes
m_rootPart.RotationOffset.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);
Quaternion axiomPartRotation =
new Quaternion(part.RotationOffset.W, part.RotationOffset.X, part.RotationOffset.Y,
part.RotationOffset.Z);
axiomPartRotation = oldGroupRotation*axiomPartRotation;
axiomPartRotation = axiomRootRotation.Inverse()*axiomPartRotation;
axiomPartRotation = oldGroupRotation * axiomPartRotation;
axiomPartRotation = axiomRootRotation.Inverse() * axiomPartRotation;
part.RotationOffset =
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[0] = new ObjectPropertiesPacket.ObjectDataBlock();
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].FolderID = LLUUID.Zero;
proper.ObjectData[0].FromTaskID = 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].ObjectID = UUID;
proper.ObjectData[0].OwnerID = m_rootPart.OwnerID;
@ -1329,7 +1337,7 @@ namespace OpenSim.Region.Environment.Scenes
Quaternion partRotation =
new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
m_rootPart.RotationOffset.Z);
axDiff = partRotation.Inverse()*axDiff;
axDiff = partRotation.Inverse() * axDiff;
diff.X = axDiff.x;
diff.Y = axDiff.y;
diff.Z = axDiff.z;
@ -1431,14 +1439,14 @@ namespace OpenSim.Region.Environment.Scenes
if (prim.UUID != m_rootPart.UUID)
{
Vector3 axPos = new Vector3(prim.OffsetPosition.X, prim.OffsetPosition.Y, prim.OffsetPosition.Z);
axPos = oldParentRot*axPos;
axPos = axRot.Inverse()*axPos;
axPos = oldParentRot * axPos;
axPos = axRot.Inverse() * axPos;
prim.OffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z);
Quaternion primsRot =
new Quaternion(prim.RotationOffset.W, prim.RotationOffset.X, prim.RotationOffset.Y,
prim.RotationOffset.Z);
Quaternion newRot = oldParentRot*primsRot;
newRot = axRot.Inverse()*newRot;
Quaternion newRot = oldParentRot * primsRot;
newRot = axRot.Inverse() * newRot;
prim.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w);
prim.ScheduleTerseUpdate();
}
@ -1670,7 +1678,7 @@ namespace OpenSim.Region.Environment.Scenes
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.y * 0xff),
(int)(color.z * 0xff));
@ -1679,10 +1687,7 @@ namespace OpenSim.Region.Environment.Scenes
public void ApplyPhysics()
{
foreach(SceneObjectPart part in m_parts.Values )
{
part.ApplyPhysics();
}
m_rootPart.ApplyPhysics();
}
}
}

View File

@ -473,7 +473,6 @@ namespace OpenSim.Region.Environment.Scenes
LLObject.ObjectFlags.ObjectOwnerModify;
ApplyPermissions();
ApplyPhysics();
ScheduleFullUpdate();
}
@ -512,7 +511,7 @@ namespace OpenSim.Region.Environment.Scenes
ObjectFlags = flags;
ApplyPermissions();
ApplyPhysics();
// ApplyPhysics();
ScheduleFullUpdate();
}