diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index 63f1363729..e05e8f677a 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -102,9 +102,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
Vector3 groupPosition = new Vector3(10, 20, 30);
Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
- Vector3 offsetPosition = new Vector3(5, 10, 15);
+// Vector3 offsetPosition = new Vector3(5, 10, 15);
- return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName };
+ return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, Vector3.Zero) { Name = partName };
}
protected SceneObjectPart CreateSceneObjectPart2()
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index e488fe151a..a87dfb7d0f 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -684,8 +684,8 @@ namespace OpenSim.Region.Framework.Scenes
//Animation states
m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
- PhysicalPrims = startupConfig.GetBoolean("physical_prim", true);
- CollidablePrims = startupConfig.GetBoolean("collidable_prim", true);
+ PhysicalPrims = startupConfig.GetBoolean("physical_prim", PhysicalPrims);
+ CollidablePrims = startupConfig.GetBoolean("collidable_prim", CollidablePrims);
m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys);
if (RegionInfo.NonphysPrimMax > 0)
@@ -800,13 +800,11 @@ namespace OpenSim.Region.Framework.Scenes
StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
}
- ///
- /// Mock constructor for scene group persistency unit tests.
- /// SceneObjectGroup RegionId property is delegated to Scene.
- ///
- ///
public Scene(RegionInfo regInfo)
{
+ PhysicalPrims = true;
+ CollidablePrims = true;
+
BordersLocked = true;
Border northBorder = new Border();
northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize); //<---
@@ -833,8 +831,6 @@ namespace OpenSim.Region.Framework.Scenes
m_eventManager = new EventManager();
m_permissions = new ScenePermissions(this);
-
-// m_lastUpdate = Util.EnvironmentTickCount();
}
#endregion
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 1592131dc2..4bec2d4157 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -4290,7 +4290,10 @@ namespace OpenSim.Region.Framework.Scenes
AddFlag(PrimFlags.Phantom);
if (PhysActor != null)
+ {
RemoveFromPhysics();
+ pa = null;
+ }
}
else // Not phantom
{
@@ -4356,7 +4359,7 @@ namespace OpenSim.Region.Framework.Scenes
{
pa.SetVolumeDetect(1);
AddFlag(PrimFlags.Phantom); // We set this flag also if VD is active
- this.VolumeDetectActive = true;
+ VolumeDetectActive = true;
}
}
else
@@ -4364,9 +4367,9 @@ namespace OpenSim.Region.Framework.Scenes
// Remove VolumeDetect in any case. Note, it's safe to call SetVolumeDetect as often as you like
// (mumbles, well, at least if you have infinte CPU powers :-))
if (pa != null)
- PhysActor.SetVolumeDetect(0);
+ pa.SetVolumeDetect(0);
- this.VolumeDetectActive = false;
+ VolumeDetectActive = false;
}
if (SetTemporary)
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
index 882031c782..360566db4b 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
@@ -62,6 +62,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
{
TestHelpers.InMethod();
+ m_scene.AddSceneObject(m_so1);
+
SceneObjectPart rootPart = m_so1.RootPart;
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
@@ -80,6 +82,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
{
TestHelpers.InMethod();
+ m_scene.AddSceneObject(m_so1);
+
SceneObjectPart rootPart = m_so1.RootPart;
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
index b1a3ff9df5..e43136a258 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
@@ -36,13 +36,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
{
public class BasicActor : PhysicsActor
{
- private Vector3 _position;
- private Vector3 _velocity;
- private Vector3 _acceleration;
private Vector3 _size;
- private Vector3 m_rotationalVelocity;
- private bool flying;
- private bool iscolliding;
public BasicActor(Vector3 size)
{
@@ -55,11 +49,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
set { return; }
}
- public override Vector3 RotationalVelocity
- {
- get { return m_rotationalVelocity; }
- set { m_rotationalVelocity = value; }
- }
+ public override Vector3 RotationalVelocity { get; set; }
public override bool SetAlwaysRun
{
@@ -105,17 +95,9 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
set { return; }
}
- public override bool Flying
- {
- get { return flying; }
- set { flying = value; }
- }
+ public override bool Flying { get; set; }
- public override bool IsColliding
- {
- get { return iscolliding; }
- set { iscolliding = value; }
- }
+ public override bool IsColliding { get; set; }
public override bool CollidingGround
{
@@ -134,11 +116,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
get { return false; }
}
- public override Vector3 Position
- {
- get { return _position; }
- set { _position = value; }
- }
+ public override Vector3 Position { get; set; }
public override Vector3 Size
{
@@ -206,11 +184,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
get { return Vector3.Zero; }
}
- public override Vector3 Velocity
- {
- get { return _velocity; }
- set { _velocity = value; }
- }
+ public override Vector3 Velocity { get; set; }
public override Vector3 Torque
{
@@ -230,11 +204,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
set { }
}
- public override Vector3 Acceleration
- {
- get { return _acceleration; }
- set { _acceleration = value; }
- }
+ public override Vector3 Acceleration { get; set; }
public override bool Kinematic
{
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs
new file mode 100644
index 0000000000..b89eeed329
--- /dev/null
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs
@@ -0,0 +1,314 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSimulator Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Collections.Generic;
+using Nini.Config;
+using OpenMetaverse;
+using OpenSim.Framework;
+using OpenSim.Region.Physics.Manager;
+
+namespace OpenSim.Region.Physics.BasicPhysicsPlugin
+{
+ public class BasicPhysicsPrim : PhysicsActor
+ {
+ private Vector3 _size;
+ private PrimitiveBaseShape _shape;
+
+ public BasicPhysicsPrim(
+ string name, uint localId, Vector3 position, Vector3 size, Quaternion orientation, PrimitiveBaseShape shape)
+ {
+ Name = name;
+ LocalID = localId;
+ Position = position;
+ Size = size;
+ Orientation = orientation;
+ Shape = shape;
+ }
+
+ public override int PhysicsActorType
+ {
+ get { return (int) ActorTypes.Agent; }
+ set { return; }
+ }
+
+ public override Vector3 RotationalVelocity { get; set; }
+
+ public override bool SetAlwaysRun
+ {
+ get { return false; }
+ set { return; }
+ }
+
+ public override uint LocalID
+ {
+ set { return; }
+ }
+
+ public override bool Grabbed
+ {
+ set { return; }
+ }
+
+ public override bool Selected
+ {
+ set { return; }
+ }
+
+ public override float Buoyancy
+ {
+ get { return 0f; }
+ set { return; }
+ }
+
+ public override bool FloatOnWater
+ {
+ set { return; }
+ }
+
+ public override bool IsPhysical
+ {
+ get { return false; }
+ set { return; }
+ }
+
+ public override bool ThrottleUpdates
+ {
+ get { return false; }
+ set { return; }
+ }
+
+ public override bool Flying { get; set; }
+
+ public override bool IsColliding { get; set; }
+
+ public override bool CollidingGround
+ {
+ get { return false; }
+ set { return; }
+ }
+
+ public override bool CollidingObj
+ {
+ get { return false; }
+ set { return; }
+ }
+
+ public override bool Stopped
+ {
+ get { return false; }
+ }
+
+ public override Vector3 Position { get; set; }
+
+ public override Vector3 Size
+ {
+ get { return _size; }
+ set {
+ _size = value;
+ _size.Z = _size.Z / 2.0f;
+ }
+ }
+
+ public override PrimitiveBaseShape Shape
+ {
+ set { _shape = value; }
+ }
+
+ public override float Mass
+ {
+ get { return 0f; }
+ }
+
+ public override Vector3 Force
+ {
+ get { return Vector3.Zero; }
+ set { return; }
+ }
+
+ public override int VehicleType
+ {
+ get { return 0; }
+ set { return; }
+ }
+
+ public override void VehicleFloatParam(int param, float value)
+ {
+
+ }
+
+ public override void VehicleVectorParam(int param, Vector3 value)
+ {
+
+ }
+
+ public override void VehicleRotationParam(int param, Quaternion rotation)
+ {
+
+ }
+
+ public override void VehicleFlags(int param, bool remove)
+ {
+
+ }
+
+ public override void SetVolumeDetect(int param)
+ {
+
+ }
+
+ public override Vector3 CenterOfMass
+ {
+ get { return Vector3.Zero; }
+ }
+
+ public override Vector3 GeometricCenter
+ {
+ get { return Vector3.Zero; }
+ }
+
+ public override Vector3 Velocity { get; set; }
+
+ public override Vector3 Torque
+ {
+ get { return Vector3.Zero; }
+ set { return; }
+ }
+
+ public override float CollisionScore
+ {
+ get { return 0f; }
+ set { }
+ }
+
+ public override Quaternion Orientation { get; set; }
+
+ public override Vector3 Acceleration { get; set; }
+
+ public override bool Kinematic
+ {
+ get { return true; }
+ set { }
+ }
+
+ public override void link(PhysicsActor obj)
+ {
+ }
+
+ public override void delink()
+ {
+ }
+
+ public override void LockAngularMotion(Vector3 axis)
+ {
+ }
+
+ public override void AddForce(Vector3 force, bool pushforce)
+ {
+ }
+
+ public override void AddAngularForce(Vector3 force, bool pushforce)
+ {
+ }
+
+ public override void SetMomentum(Vector3 momentum)
+ {
+ }
+
+ public override void CrossingFailure()
+ {
+ }
+
+ public override Vector3 PIDTarget
+ {
+ set { return; }
+ }
+
+ public override bool PIDActive
+ {
+ set { return; }
+ }
+
+ public override float PIDTau
+ {
+ set { return; }
+ }
+
+ public override float PIDHoverHeight
+ {
+ set { return; }
+ }
+
+ public override bool PIDHoverActive
+ {
+ set { return; }
+ }
+
+ public override PIDHoverType PIDHoverType
+ {
+ set { return; }
+ }
+
+ public override float PIDHoverTau
+ {
+ set { return; }
+ }
+
+ public override Quaternion APIDTarget
+ {
+ set { return; }
+ }
+
+ public override bool APIDActive
+ {
+ set { return; }
+ }
+
+ public override float APIDStrength
+ {
+ set { return; }
+ }
+
+ public override float APIDDamping
+ {
+ set { return; }
+ }
+
+ public override void SubscribeEvents(int ms)
+ {
+ }
+
+ public override void UnSubscribeEvents()
+ {
+ }
+
+ public override bool SubscribedEvents()
+ {
+ return false;
+ }
+ }
+}
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
index 2e1421649f..f5826edd2c 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
@@ -34,9 +34,17 @@ using OpenSim.Region.Physics.Manager;
namespace OpenSim.Region.Physics.BasicPhysicsPlugin
{
+ ///
+ /// This is an incomplete extremely basic physics implementation
+ ///
+ ///
+ /// Not useful for anything at the moment apart from some regression testing in other components where some form
+ /// of physics plugin is needed.
+ ///
public class BasicScene : PhysicsScene
{
private List _actors = new List();
+ private List _prims = new List();
private float[] _heightMap;
//protected internal string sceneIdentifier;
@@ -50,10 +58,19 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
{
}
- public override void Dispose()
- {
+ public override void Dispose() {}
+ public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
+ Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
+ {
+ BasicPhysicsPrim prim = new BasicPhysicsPrim(primName, localid, position, size, rotation, pbs);
+ prim.IsPhysical = isPhysical;
+
+ _prims.Add(prim);
+
+ return prim;
}
+
public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
{
BasicActor act = new BasicActor(size);
@@ -63,30 +80,18 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
return act;
}
- public override void RemovePrim(PhysicsActor prim)
+ public override void RemovePrim(PhysicsActor actor)
{
+ BasicPhysicsPrim prim = (BasicPhysicsPrim)actor;
+ if (_prims.Contains(prim))
+ _prims.Remove(prim);
}
public override void RemoveAvatar(PhysicsActor actor)
{
- BasicActor act = (BasicActor) actor;
+ BasicActor act = (BasicActor)actor;
if (_actors.Contains(act))
- {
_actors.Remove(act);
- }
- }
-
-/*
- public override PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation)
- {
- return null;
- }
-*/
-
- public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
- Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
- {
- return null;
}
public override void AddPhysicsActorTaint(PhysicsActor prim)