mirror of
https://github.com/opensim/opensim.git
synced 2026-08-04 16:22:50 +08:00
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
This commit is contained in:
@@ -2163,12 +2163,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
part.RemoveFromPhysics();
|
||||
}
|
||||
}
|
||||
|
||||
// if (rootPart.PhysActor != null)
|
||||
// {
|
||||
// PhysicsScene.RemovePrim(rootPart.PhysActor);
|
||||
// rootPart.PhysActor = null;
|
||||
// }
|
||||
|
||||
if (UnlinkSceneObject(group, false))
|
||||
{
|
||||
@@ -2572,7 +2566,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
SceneObjectGroup grp = sceneObject;
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.GetFromItemID(), grp.UUID);
|
||||
"[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.FromItemID, grp.UUID);
|
||||
m_log.DebugFormat(
|
||||
"[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition);
|
||||
|
||||
|
||||
@@ -571,7 +571,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
set { m_LoopSoundSlavePrims = value; }
|
||||
}
|
||||
|
||||
// The UUID for the Region this Object is in.
|
||||
/// <summary>
|
||||
/// The UUID for the region this object is in.
|
||||
/// </summary>
|
||||
public UUID RegionUUID
|
||||
{
|
||||
get
|
||||
@@ -584,6 +586,22 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The item ID that this object was rezzed from, if applicable.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If not applicable will be UUID.Zero
|
||||
/// </remarks>
|
||||
public UUID FromItemID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The folder ID that this object was rezzed from, if applicable.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If not applicable will be UUID.Zero
|
||||
/// </remarks>
|
||||
public UUID FromFolderID { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
// ~SceneObjectGroup()
|
||||
@@ -646,18 +664,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
public void SetFromItemID(UUID AssetId)
|
||||
{
|
||||
SceneObjectPart[] parts = m_parts.GetArray();
|
||||
for (int i = 0; i < parts.Length; i++)
|
||||
parts[i].FromItemID = AssetId;
|
||||
}
|
||||
|
||||
public UUID GetFromItemID()
|
||||
{
|
||||
return m_rootPart.FromItemID;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hooks this object up to the backup event so that it is persisted to the database when the update thread executes.
|
||||
/// </summary>
|
||||
@@ -2687,6 +2693,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
m_rootPart.AttachedPos = pos;
|
||||
}
|
||||
|
||||
if (RootPart.GetStatusSandbox())
|
||||
{
|
||||
if (Util.GetDistanceTo(RootPart.StatusSandboxPos, pos) > 10)
|
||||
@@ -2697,8 +2704,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false);
|
||||
}
|
||||
}
|
||||
AbsolutePosition = pos;
|
||||
|
||||
AbsolutePosition = pos;
|
||||
HasGroupChanged = true;
|
||||
}
|
||||
|
||||
@@ -3270,7 +3277,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public virtual string ExtraToXmlString()
|
||||
{
|
||||
return "<ExtraFromItemID>" + GetFromItemID().ToString() + "</ExtraFromItemID>";
|
||||
return "<ExtraFromItemID>" + FromItemID.ToString() + "</ExtraFromItemID>";
|
||||
}
|
||||
|
||||
public virtual void ExtraFromXmlString(string xmlstr)
|
||||
@@ -3282,7 +3289,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
UUID uuid = UUID.Zero;
|
||||
UUID.TryParse(id, out uuid);
|
||||
|
||||
SetFromItemID(uuid);
|
||||
FromItemID = uuid;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -125,12 +125,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <value>
|
||||
/// Is this sop a root part?
|
||||
/// Is this a root part?
|
||||
/// </value>
|
||||
|
||||
/// <remarks>
|
||||
/// This will return true even if the whole object is attached to an avatar.
|
||||
/// </remarks>
|
||||
public bool IsRoot
|
||||
{
|
||||
get { return ParentGroup.RootPart == this; }
|
||||
get { return ParentGroup.RootPart == this; }
|
||||
}
|
||||
|
||||
#region Fields
|
||||
@@ -159,15 +161,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// If another thread is simultaneously turning physics off on this part then this refernece could become
|
||||
/// null at any time.
|
||||
/// </remarks>
|
||||
public PhysicsActor PhysActor
|
||||
{
|
||||
get { return m_physActor; }
|
||||
set
|
||||
{
|
||||
// m_log.DebugFormat("[SOP]: PhysActor set to {0} for {1} {2}", value, Name, UUID);
|
||||
m_physActor = value;
|
||||
}
|
||||
}
|
||||
public PhysicsActor PhysActor { get; set; }
|
||||
|
||||
//Xantor 20080528 Sound stuff:
|
||||
// Note: This isn't persisted in the database right now, as the fields for that aren't just there yet.
|
||||
@@ -187,10 +181,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public uint TimeStampLastActivity; // Will be used for AutoReturn
|
||||
|
||||
public uint TimeStampTerse;
|
||||
|
||||
public UUID FromItemID;
|
||||
|
||||
public UUID FromFolderID;
|
||||
|
||||
public int STATUS_ROTATE_X;
|
||||
|
||||
@@ -266,7 +256,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
private bool m_passTouches;
|
||||
|
||||
private PhysicsActor m_physActor;
|
||||
protected Vector3 m_acceleration;
|
||||
protected Vector3 m_angularVelocity;
|
||||
|
||||
@@ -1112,6 +1101,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The parent ID of this part.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If this is a root part which is not attached to an avatar then the value will be 0.
|
||||
/// If this is a root part which is attached to an avatar then the value is the local id of that avatar.
|
||||
/// If this is a child part then the value is the local ID of the root part.
|
||||
/// </remarks>
|
||||
public uint ParentID
|
||||
{
|
||||
get { return _parentID; }
|
||||
@@ -1488,40 +1485,17 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (VolumeDetectActive)
|
||||
isPhantom = false;
|
||||
|
||||
// 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 or an attachment, which is phantom by definition
|
||||
// or flexible
|
||||
if (!isPhantom && !ParentGroup.IsAttachment && !(Shape.PathCurve == (byte)Extrusion.Flexible))
|
||||
{
|
||||
try
|
||||
{
|
||||
PhysActor = ParentGroup.Scene.PhysicsScene.AddPrimShape(
|
||||
string.Format("{0}/{1}", Name, UUID),
|
||||
Shape,
|
||||
AbsolutePosition,
|
||||
Scale,
|
||||
RotationOffset,
|
||||
RigidBody,
|
||||
m_localId);
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid);
|
||||
PhysActor = null;
|
||||
}
|
||||
// Added clarification.. since A rigid body is an object that you can kick around, etc.
|
||||
bool rigidBody = isPhysical && !isPhantom;
|
||||
|
||||
// Basic Physics can also return null as well as an exception catch.
|
||||
PhysicsActor pa = PhysActor;
|
||||
PhysicsActor pa = AddToPhysics(rigidBody);
|
||||
|
||||
if (pa != null)
|
||||
{
|
||||
pa.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info
|
||||
pa.SetMaterial(Material);
|
||||
DoPhysicsPropertyUpdate(RigidBody, true);
|
||||
pa.SetVolumeDetect(VolumeDetectActive ? 1 : 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4322,41 +4296,36 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (ParentGroup.Scene == null)
|
||||
return;
|
||||
|
||||
if (ParentGroup.Scene.CollidablePrims && PhysActor == null)
|
||||
if (ParentGroup.Scene.CollidablePrims && pa == null)
|
||||
{
|
||||
// It's not phantom anymore. So make sure the physics engine get's knowledge of it
|
||||
PhysActor = ParentGroup.Scene.PhysicsScene.AddPrimShape(
|
||||
string.Format("{0}/{1}", Name, UUID),
|
||||
Shape,
|
||||
AbsolutePosition,
|
||||
Scale,
|
||||
RotationOffset,
|
||||
UsePhysics,
|
||||
m_localId);
|
||||
pa = AddToPhysics(UsePhysics);
|
||||
|
||||
PhysActor.SetMaterial(Material);
|
||||
DoPhysicsPropertyUpdate(UsePhysics, true);
|
||||
|
||||
if (!ParentGroup.IsDeleted)
|
||||
if (pa != null)
|
||||
{
|
||||
if (LocalId == ParentGroup.RootPart.LocalId)
|
||||
pa.SetMaterial(Material);
|
||||
DoPhysicsPropertyUpdate(UsePhysics, true);
|
||||
|
||||
if (!ParentGroup.IsDeleted)
|
||||
{
|
||||
ParentGroup.CheckSculptAndLoad();
|
||||
if (LocalId == ParentGroup.RootPart.LocalId)
|
||||
{
|
||||
ParentGroup.CheckSculptAndLoad();
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
((AggregateScriptEvents & scriptEvents.collision) != 0) ||
|
||||
((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
|
||||
((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
|
||||
((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
|
||||
((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
|
||||
((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
|
||||
(CollisionSound != UUID.Zero)
|
||||
)
|
||||
{
|
||||
pa.OnCollisionUpdate += PhysicsCollision;
|
||||
pa.SubscribeEvents(1000);
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
((AggregateScriptEvents & scriptEvents.collision) != 0) ||
|
||||
((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
|
||||
((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
|
||||
((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
|
||||
((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
|
||||
((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
|
||||
(CollisionSound != UUID.Zero)
|
||||
)
|
||||
{
|
||||
PhysActor.OnCollisionUpdate += PhysicsCollision;
|
||||
PhysActor.SubscribeEvents(1000);
|
||||
}
|
||||
}
|
||||
else // it already has a physical representation
|
||||
@@ -4418,7 +4387,52 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This removes the part from physics
|
||||
/// Adds this part to the physics scene.
|
||||
/// </summary>
|
||||
/// <remarks>This method also sets the PhysActor property.</remarks>
|
||||
/// <param name="rigidBody">Add this prim with a rigid body.</param>
|
||||
/// <returns>
|
||||
/// The physics actor. null if there was a failure.
|
||||
/// </returns>
|
||||
private PhysicsActor AddToPhysics(bool rigidBody)
|
||||
{
|
||||
PhysicsActor pa;
|
||||
|
||||
try
|
||||
{
|
||||
pa = ParentGroup.Scene.PhysicsScene.AddPrimShape(
|
||||
string.Format("{0}/{1}", Name, UUID),
|
||||
Shape,
|
||||
AbsolutePosition,
|
||||
Scale,
|
||||
RotationOffset,
|
||||
rigidBody,
|
||||
m_localId);
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid);
|
||||
pa = null;
|
||||
}
|
||||
|
||||
// FIXME: Ideally we wouldn't set the property here to reduce situations where threads changing physical
|
||||
// properties can stop on each other. However, DoPhysicsPropertyUpdate() currently relies on PhysActor
|
||||
// being set.
|
||||
PhysActor = pa;
|
||||
|
||||
// Basic Physics can also return null as well as an exception catch.
|
||||
if (pa != null)
|
||||
{
|
||||
pa.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info
|
||||
pa.SetMaterial(Material);
|
||||
DoPhysicsPropertyUpdate(rigidBody, true);
|
||||
}
|
||||
|
||||
return pa;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This removes the part from the physics scene.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This isn't the same as turning off physical, since even without being physical the prim has a physics
|
||||
|
||||
@@ -3514,6 +3514,22 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the mass.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The mass.
|
||||
/// </returns>
|
||||
public float GetMass()
|
||||
{
|
||||
PhysicsActor pa = PhysicsActor;
|
||||
|
||||
if (pa != null)
|
||||
return pa.Mass;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
internal void PushForce(Vector3 impulse)
|
||||
{
|
||||
if (PhysicsActor != null)
|
||||
|
||||
Reference in New Issue
Block a user