* Pass 2 of collidable (non physical) linksets

* Linkset status is now persistent
* Tweaked a physics child prim positioning hack to generate less database saves
* Re-factored physics object creation calls into ApplyPhysics.  To create a new physics representation of an object or linkset, it's only necessary to call *group*.ApplyPhysics(bool m_physicalPrim).  *lbsa has been waiting for this refactoring*
* We have collidable linksets now. (they don't become phantom anymore)
ThreadPoolClientBranch
Teravus Ovares 2008-01-15 04:14:27 +00:00
parent b25f9f322c
commit 45e945616b
4 changed files with 33 additions and 39 deletions

View File

@ -755,6 +755,7 @@ namespace OpenSim.Region.Environment.Scenes
group.AbsolutePosition = pos;
SceneObjectPart rootPart = group.GetChildPart(group.UUID);
rootPart.ApplySanePermissions();
group.ApplyPhysics(m_physicalPrim);
//bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0)&& m_physicalPrim);
//if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
//{

View File

@ -908,17 +908,8 @@ namespace OpenSim.Region.Environment.Scenes
SceneObjectPart rootPart = group.GetChildPart(group.UUID);
rootPart.ApplySanePermissions();
bool UsePhysics = (((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim);
if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
rootPart.PhysActor = PhysicsScene.AddPrimShape(
rootPart.Name,
rootPart.Shape,
new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y,
rootPart.AbsolutePosition.Z),
new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics);
rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
group.ApplyPhysics(m_physicalPrim);
//rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
}
MainLog.Instance.Verbose("SCENE", "Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)");
@ -1054,19 +1045,7 @@ namespace OpenSim.Region.Environment.Scenes
//rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom;
}
// if not phantom, add to physics
bool UsePhysics = (((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim);
if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
{
rootPart.PhysActor =
PhysicsScene.AddPrimShape(
rootPart.Name,
rootPart.Shape,
new PhysicsVector(pos.X, pos.Y, pos.Z),
new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z),
new Quaternion(), UsePhysics);
// subscribe to physics events.
rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
}
sceneOb.ApplyPhysics(m_physicalPrim);
}
public void AddTree(LLVector3 scale, LLQuaternion rotation, LLVector3 position,

View File

@ -249,7 +249,7 @@ namespace OpenSim.Region.Environment.Scenes
AttachToBackup();
ApplyPhysics();
ApplyPhysics(scene.m_physicalPrim);
ScheduleGroupForFullUpdate();
}
@ -302,7 +302,7 @@ namespace OpenSim.Region.Environment.Scenes
AttachToBackup();
ApplyPhysics();
ApplyPhysics(scene.m_physicalPrim);
ScheduleGroupForFullUpdate();
}
@ -426,7 +426,7 @@ namespace OpenSim.Region.Environment.Scenes
AttachToBackup();
ApplyPhysics();
//ApplyPhysics(scene.m_physicalPrim);
}
/// <summary>
@ -1577,6 +1577,12 @@ namespace OpenSim.Region.Environment.Scenes
}
}
public void ResetChildPrimPhysicsPositions()
{
AbsolutePosition = AbsolutePosition;
HasChanged = false;
}
public LLUUID GetPartsFullID(uint localID)
{
SceneObjectPart part = GetChildPart(localID);
@ -1649,18 +1655,22 @@ namespace OpenSim.Region.Environment.Scenes
Text = text;
}
public void ApplyPhysics()
public void ApplyPhysics(bool m_physicalPrim)
{
if (m_parts.Count > 1)
{
foreach (SceneObjectPart parts in m_parts.Values)
{
parts.ApplyPhysics();
parts.ApplyPhysics(m_rootPart.ObjectFlags, m_physicalPrim);
// Hack to get the physics scene geometries in the right spot
ResetChildPrimPhysicsPositions();
}
}
else
{
m_rootPart.ApplyPhysics();
m_rootPart.ApplyPhysics(m_rootPart.ObjectFlags, m_physicalPrim);
}
}
}

View File

@ -261,7 +261,7 @@ namespace OpenSim.Region.Environment.Scenes
try
{
// Hack to get the child prim to update positions in the physics engine
ParentGroup.AbsolutePosition = ParentGroup.AbsolutePosition;
ParentGroup.ResetChildPrimPhysicsPositions();
}
catch (System.NullReferenceException)
{
@ -646,14 +646,17 @@ namespace OpenSim.Region.Environment.Scenes
return newobject;
}
public void ApplyPhysics()
public void ApplyPhysics(uint rootObjectFlags, bool m_physicalPrim)
{
bool isPhysical = ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0);
bool isPhantom = ((ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) != 0);
bool usePhysics = isPhysical && !isPhantom;
bool isPhysical = (((rootObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0) && m_physicalPrim);
bool isPhantom = ((rootObjectFlags & (uint) LLObject.ObjectFlags.Phantom) != 0);
if (usePhysics)
// Added clarification.. since A rigid body is an object that you can kick around, etc.
bool RigidBody = isPhysical && !isPhantom;
// The only time the physics scene shouldn't know about the prim is if it's phantom
if (!isPhantom)
{
PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
Name,
@ -662,10 +665,11 @@ namespace OpenSim.Region.Environment.Scenes
AbsolutePosition.Z),
new PhysicsVector(Scale.X, Scale.Y, Scale.Z),
new Quaternion(RotationOffset.W, RotationOffset.X,
RotationOffset.Y, RotationOffset.Z), usePhysics);
}
RotationOffset.Y, RotationOffset.Z), RigidBody);
DoPhysicsPropertyUpdate(usePhysics, true);
DoPhysicsPropertyUpdate(RigidBody, true);
}
}
public void ApplyNextOwnerPermissions()