Merge branch 'master' of ssh://melanie@3dhosting.de/var/git/careminster into careminster
commit
65b3e13010
|
@ -768,6 +768,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
{
|
{
|
||||||
g.RootPart.AttachPoint = g.RootPart.Shape.State;
|
g.RootPart.AttachPoint = g.RootPart.Shape.State;
|
||||||
g.RootPart.AttachOffset = g.AbsolutePosition;
|
g.RootPart.AttachOffset = g.AbsolutePosition;
|
||||||
|
g.RootPart.Shape.State = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
objlist.Add(g);
|
objlist.Add(g);
|
||||||
|
@ -800,6 +801,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml);
|
SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml);
|
||||||
g.RootPart.AttachPoint = g.RootPart.Shape.State;
|
g.RootPart.AttachPoint = g.RootPart.Shape.State;
|
||||||
g.RootPart.AttachOffset = g.AbsolutePosition;
|
g.RootPart.AttachOffset = g.AbsolutePosition;
|
||||||
|
g.RootPart.Shape.State = 0;
|
||||||
|
|
||||||
objlist.Add(g);
|
objlist.Add(g);
|
||||||
XmlElement el = (XmlElement)n;
|
XmlElement el = (XmlElement)n;
|
||||||
|
|
|
@ -1519,8 +1519,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
|
if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
|
||||||
{
|
{
|
||||||
// VolumeDetect can't be set via UI and will always be off when a change is made there
|
// VolumeDetect can't be set via UI and will always be off when a change is made there
|
||||||
if (PhysData.PhysShapeType == PhysShapeType.invalid)
|
// now only change volume dtc if phantom off
|
||||||
group.UpdatePrimFlags(localID, UsePhysics, SetTemporary, SetPhantom, false);
|
|
||||||
|
if (PhysData.PhysShapeType == PhysShapeType.invalid) // check for extraPhysics data
|
||||||
|
{
|
||||||
|
bool vdtc;
|
||||||
|
if (SetPhantom) // if phantom keep volumedtc
|
||||||
|
vdtc = group.RootPart.VolumeDetectActive;
|
||||||
|
else // else turn it off
|
||||||
|
vdtc = false;
|
||||||
|
|
||||||
|
group.UpdatePrimFlags(localID, UsePhysics, SetTemporary, SetPhantom, vdtc);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SceneObjectPart part = GetSceneObjectPart(localID);
|
SceneObjectPart part = GetSceneObjectPart(localID);
|
||||||
|
|
|
@ -1941,6 +1941,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// "[SCENE]: Storing {0}, {1} in {2}",
|
// "[SCENE]: Storing {0}, {1} in {2}",
|
||||||
// Name, UUID, m_scene.RegionInfo.RegionName);
|
// Name, UUID, m_scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
|
if (RootPart.Shape.PCode == 9 && RootPart.Shape.State != 0)
|
||||||
|
{
|
||||||
|
RootPart.Shape.State = 0;
|
||||||
|
ScheduleGroupForFullUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
SceneObjectGroup backup_group = Copy(false);
|
SceneObjectGroup backup_group = Copy(false);
|
||||||
backup_group.RootPart.Velocity = RootPart.Velocity;
|
backup_group.RootPart.Velocity = RootPart.Velocity;
|
||||||
backup_group.RootPart.Acceleration = RootPart.Acceleration;
|
backup_group.RootPart.Acceleration = RootPart.Acceleration;
|
||||||
|
|
|
@ -1830,7 +1830,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void ApplyPhysics(uint _ObjectFlags, bool _VolumeDetectActive, bool building)
|
public void ApplyPhysics(uint _ObjectFlags, bool _VolumeDetectActive, bool building)
|
||||||
{
|
{
|
||||||
VolumeDetectActive = _VolumeDetectActive; //?? as is used this is redundante
|
VolumeDetectActive = _VolumeDetectActive;
|
||||||
|
|
||||||
if (!ParentGroup.Scene.CollidablePrims)
|
if (!ParentGroup.Scene.CollidablePrims)
|
||||||
return;
|
return;
|
||||||
|
@ -1839,7 +1839,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool isPhysical = (_ObjectFlags & (uint) PrimFlags.Physics) != 0;
|
bool isPhysical = (_ObjectFlags & (uint) PrimFlags.Physics) != 0;
|
||||||
bool isPhantom = (_ObjectFlags & (uint) PrimFlags.Phantom) != 0;
|
bool isPhantom = (_ObjectFlags & (uint)PrimFlags.Phantom) != 0;
|
||||||
|
|
||||||
|
if (_VolumeDetectActive)
|
||||||
|
isPhantom = true;
|
||||||
|
|
||||||
if (IsJoint())
|
if (IsJoint())
|
||||||
{
|
{
|
||||||
|
@ -2065,6 +2068,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Do a physics propery update for this part.
|
/// Do a physics propery update for this part.
|
||||||
|
/// now also updates phantom and volume detector
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="UsePhysics"></param>
|
/// <param name="UsePhysics"></param>
|
||||||
/// <param name="isNew"></param>
|
/// <param name="isNew"></param>
|
||||||
|
@ -2096,7 +2100,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (ParentGroup.RootPart == this)
|
if (ParentGroup.RootPart == this)
|
||||||
AngularVelocity = new Vector3(0, 0, 0);
|
AngularVelocity = new Vector3(0, 0, 0);
|
||||||
|
|
||||||
if (pa.Phantom)
|
if (pa.Phantom && !VolumeDetectActive)
|
||||||
{
|
{
|
||||||
RemoveFromPhysics();
|
RemoveFromPhysics();
|
||||||
return;
|
return;
|
||||||
|
@ -2143,6 +2147,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (pa.Phantom != phan)
|
if (pa.Phantom != phan)
|
||||||
pa.Phantom = phan;
|
pa.Phantom = phan;
|
||||||
|
|
||||||
|
// some engines dont' have this check still
|
||||||
|
// if (VolumeDetectActive != pa.IsVolumeDtc)
|
||||||
|
{
|
||||||
|
if (VolumeDetectActive)
|
||||||
|
pa.SetVolumeDetect(1);
|
||||||
|
else
|
||||||
|
pa.SetVolumeDetect(0);
|
||||||
|
}
|
||||||
|
|
||||||
// If this part is a sculpt then delay the physics update until we've asynchronously loaded the
|
// If this part is a sculpt then delay the physics update until we've asynchronously loaded the
|
||||||
// mesh data.
|
// mesh data.
|
||||||
|
@ -4599,6 +4611,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if ((UsePhysics == wasUsingPhysics) && (wasTemporary == SetTemporary) && (wasPhantom == SetPhantom) && (SetVD == wasVD))
|
if ((UsePhysics == wasUsingPhysics) && (wasTemporary == SetTemporary) && (wasPhantom == SetPhantom) && (SetVD == wasVD))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
VolumeDetectActive = SetVD;
|
||||||
|
|
||||||
|
// volume detector implies phantom
|
||||||
|
if (VolumeDetectActive)
|
||||||
|
SetPhantom = true;
|
||||||
|
|
||||||
if (UsePhysics)
|
if (UsePhysics)
|
||||||
AddFlag(PrimFlags.Physics);
|
AddFlag(PrimFlags.Physics);
|
||||||
else
|
else
|
||||||
|
@ -4614,7 +4632,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
else
|
else
|
||||||
RemFlag(PrimFlags.TemporaryOnRez);
|
RemFlag(PrimFlags.TemporaryOnRez);
|
||||||
|
|
||||||
VolumeDetectActive = SetVD;
|
|
||||||
|
|
||||||
if (ParentGroup.Scene == null)
|
if (ParentGroup.Scene == null)
|
||||||
return;
|
return;
|
||||||
|
@ -4624,7 +4641,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (pa != null && building && pa.Building != building)
|
if (pa != null && building && pa.Building != building)
|
||||||
pa.Building = building;
|
pa.Building = building;
|
||||||
|
|
||||||
if ((SetPhantom && !UsePhysics) || ParentGroup.IsAttachment || PhysicsShapeType == (byte)PhysShapeType.none
|
if ((SetPhantom && !UsePhysics && !SetVD) || ParentGroup.IsAttachment || PhysicsShapeType == (byte)PhysShapeType.none
|
||||||
|| (Shape.PathCurve == (byte)Extrusion.Flexible))
|
|| (Shape.PathCurve == (byte)Extrusion.Flexible))
|
||||||
{
|
{
|
||||||
if (pa != null)
|
if (pa != null)
|
||||||
|
@ -4669,12 +4686,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
else // it already has a physical representation
|
else // it already has a physical representation
|
||||||
{
|
{
|
||||||
DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status.
|
DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status.
|
||||||
|
/* moved into DoPhysicsPropertyUpdate
|
||||||
if(VolumeDetectActive)
|
if(VolumeDetectActive)
|
||||||
pa.SetVolumeDetect(1);
|
pa.SetVolumeDetect(1);
|
||||||
else
|
else
|
||||||
pa.SetVolumeDetect(0);
|
pa.SetVolumeDetect(0);
|
||||||
|
*/
|
||||||
if (pa.Building != building)
|
if (pa.Building != building)
|
||||||
pa.Building = building;
|
pa.Building = building;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1075,6 +1075,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TeleportWithMomentum(Vector3 pos)
|
public void TeleportWithMomentum(Vector3 pos)
|
||||||
|
{
|
||||||
|
TeleportWithMomentum(pos, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void TeleportWithMomentum(Vector3 pos, Vector3? v)
|
||||||
{
|
{
|
||||||
bool isFlying = Flying;
|
bool isFlying = Flying;
|
||||||
Vector3 vel = Velocity;
|
Vector3 vel = Velocity;
|
||||||
|
@ -1083,7 +1088,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
AbsolutePosition = pos;
|
AbsolutePosition = pos;
|
||||||
AddToPhysicalScene(isFlying);
|
AddToPhysicalScene(isFlying);
|
||||||
if (PhysicsActor != null)
|
if (PhysicsActor != null)
|
||||||
PhysicsActor.SetMomentum(vel);
|
{
|
||||||
|
if (v.HasValue)
|
||||||
|
PhysicsActor.SetMomentum((Vector3)v);
|
||||||
|
else
|
||||||
|
PhysicsActor.SetMomentum(vel);
|
||||||
|
}
|
||||||
|
|
||||||
SendTerseUpdateToAllClients();
|
SendTerseUpdateToAllClients();
|
||||||
}
|
}
|
||||||
|
|
|
@ -323,9 +323,15 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
{
|
{
|
||||||
NPCAvatar av;
|
NPCAvatar av;
|
||||||
if (m_avatars.TryGetValue(npcID, out av))
|
if (m_avatars.TryGetValue(npcID, out av))
|
||||||
|
{
|
||||||
|
if (npcID == callerID)
|
||||||
|
return true;
|
||||||
return CheckPermissions(av, callerID);
|
return CheckPermissions(av, callerID);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,7 +343,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
/// <returns>true if they do, false if they don't.</returns>
|
/// <returns>true if they do, false if they don't.</returns>
|
||||||
private bool CheckPermissions(NPCAvatar av, UUID callerID)
|
private bool CheckPermissions(NPCAvatar av, UUID callerID)
|
||||||
{
|
{
|
||||||
return callerID == UUID.Zero || av.OwnerID == UUID.Zero || av.OwnerID == callerID;
|
return callerID == UUID.Zero || av.OwnerID == UUID.Zero || av.OwnerID == callerID || av.AgentId == callerID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -771,16 +771,10 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
/// <param name="timeStep"></param>
|
/// <param name="timeStep"></param>
|
||||||
public void Move(float timeStep, List<OdeCharacter> defects)
|
public void Move(float timeStep, List<OdeCharacter> defects)
|
||||||
{
|
{
|
||||||
// no lock; for now it's only called from within Simulate()
|
|
||||||
|
|
||||||
// If the PID Controller isn't active then we set our force
|
|
||||||
// calculating base velocity to the current position
|
|
||||||
|
|
||||||
if (Body == IntPtr.Zero)
|
if (Body == IntPtr.Zero)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
d.Vector3 dtmp;
|
d.Vector3 dtmp = d.BodyGetPosition(Body);
|
||||||
d.BodyCopyPosition(Body, out dtmp);
|
|
||||||
Vector3 localpos = new Vector3(dtmp.X, dtmp.Y, dtmp.Z);
|
Vector3 localpos = new Vector3(dtmp.X, dtmp.Y, dtmp.Z);
|
||||||
|
|
||||||
// the Amotor still lets avatar rotation to drift during colisions
|
// the Amotor still lets avatar rotation to drift during colisions
|
||||||
|
@ -797,22 +791,43 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
{
|
{
|
||||||
_zeroPosition = localpos;
|
_zeroPosition = localpos;
|
||||||
}
|
}
|
||||||
//PidStatus = true;
|
|
||||||
|
|
||||||
|
|
||||||
if (!localpos.IsFinite())
|
if (!localpos.IsFinite())
|
||||||
{
|
{
|
||||||
|
|
||||||
m_log.Warn("[PHYSICS]: Avatar Position is non-finite!");
|
m_log.Warn("[PHYSICS]: Avatar Position is non-finite!");
|
||||||
defects.Add(this);
|
defects.Add(this);
|
||||||
// _parent_scene.RemoveCharacter(this);
|
// _parent_scene.RemoveCharacter(this);
|
||||||
|
|
||||||
// destroy avatar capsule and related ODE data
|
// destroy avatar capsule and related ODE data
|
||||||
AvatarGeomAndBodyDestroy();
|
AvatarGeomAndBodyDestroy();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check outbounds forcing to be in world
|
||||||
|
bool fixbody = false;
|
||||||
|
if (localpos.X < 0.0f)
|
||||||
|
{
|
||||||
|
fixbody = true;
|
||||||
|
localpos.X = 0.1f;
|
||||||
|
}
|
||||||
|
else if (localpos.X > _parent_scene.WorldExtents.X - 0.1f)
|
||||||
|
{
|
||||||
|
fixbody = true;
|
||||||
|
localpos.X = _parent_scene.WorldExtents.X - 0.1f;
|
||||||
|
}
|
||||||
|
if (localpos.Y < 0.0f)
|
||||||
|
{
|
||||||
|
fixbody = true;
|
||||||
|
localpos.Y = 0.1f;
|
||||||
|
}
|
||||||
|
else if (localpos.Y > _parent_scene.WorldExtents.Y - 0.1)
|
||||||
|
{
|
||||||
|
fixbody = true;
|
||||||
|
localpos.Y = _parent_scene.WorldExtents.Y - 0.1f;
|
||||||
|
}
|
||||||
|
if (fixbody)
|
||||||
|
d.BodySetPosition(Body, localpos.X, localpos.Y, localpos.Z);
|
||||||
|
|
||||||
Vector3 vec = Vector3.Zero;
|
Vector3 vec = Vector3.Zero;
|
||||||
dtmp = d.BodyGetLinearVel(Body);
|
dtmp = d.BodyGetLinearVel(Body);
|
||||||
Vector3 vel = new Vector3(dtmp.X, dtmp.Y, dtmp.Z);
|
Vector3 vel = new Vector3(dtmp.X, dtmp.Y, dtmp.Z);
|
||||||
|
@ -820,16 +835,12 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
float movementdivisor = 1f;
|
float movementdivisor = 1f;
|
||||||
//Ubit change divisions into multiplications below
|
//Ubit change divisions into multiplications below
|
||||||
if (!m_alwaysRun)
|
if (!m_alwaysRun)
|
||||||
{
|
|
||||||
movementdivisor = 1 / walkDivisor;
|
movementdivisor = 1 / walkDivisor;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
movementdivisor = 1 / runDivisor;
|
movementdivisor = 1 / runDivisor;
|
||||||
}
|
|
||||||
|
|
||||||
|
//******************************************
|
||||||
// colide with land
|
// colide with land
|
||||||
|
|
||||||
d.AABB aabb;
|
d.AABB aabb;
|
||||||
d.GeomGetAABB(Shell, out aabb);
|
d.GeomGetAABB(Shell, out aabb);
|
||||||
float chrminZ = aabb.MinZ;
|
float chrminZ = aabb.MinZ;
|
||||||
|
@ -851,32 +862,12 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
float depth = terrainheight - chrminZ;
|
float depth = terrainheight - chrminZ;
|
||||||
if (!flying)
|
if (!flying)
|
||||||
{
|
{
|
||||||
vec.Z = -vel.Z * PID_D * 1.5f + depth * PID_P * 50;
|
vec.Z = -vel.Z * PID_D * 1.5f + depth * PID_P * 60;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
vec.Z = depth * PID_P * 50;
|
vec.Z = depth * PID_P * 60;
|
||||||
|
|
||||||
/*
|
if (depth < 0.2f)
|
||||||
Vector3 vtmp;
|
|
||||||
vtmp.X = _target_velocity.X * timeStep;
|
|
||||||
vtmp.Y = _target_velocity.Y * timeStep;
|
|
||||||
// fake and avoid squares
|
|
||||||
float k = (Math.Abs(vtmp.X) + Math.Abs(vtmp.Y));
|
|
||||||
if (k > 0)
|
|
||||||
{
|
|
||||||
posch.X += vtmp.X;
|
|
||||||
posch.Y += vtmp.Y;
|
|
||||||
terrainheight -= _parent_scene.GetTerrainHeightAtXY(posch.X, posch.Y);
|
|
||||||
k = 1 + Math.Abs(terrainheight) / k;
|
|
||||||
movementdivisor /= k;
|
|
||||||
|
|
||||||
if (k < 1)
|
|
||||||
k = 1;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
if (depth < 0.1f)
|
|
||||||
{
|
{
|
||||||
m_iscolliding = true;
|
m_iscolliding = true;
|
||||||
m_colliderfilter = 2;
|
m_colliderfilter = 2;
|
||||||
|
@ -901,6 +892,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
else
|
else
|
||||||
m_iscollidingGround = false;
|
m_iscollidingGround = false;
|
||||||
|
|
||||||
|
//******************************************
|
||||||
|
|
||||||
// if velocity is zero, use position control; otherwise, velocity control
|
// if velocity is zero, use position control; otherwise, velocity control
|
||||||
if (_target_velocity.X == 0.0f && _target_velocity.Y == 0.0f && _target_velocity.Z == 0.0f
|
if (_target_velocity.X == 0.0f && _target_velocity.Y == 0.0f && _target_velocity.Z == 0.0f
|
||||||
|
@ -1012,97 +1004,31 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
// _parent_scene.RemoveCharacter(this);
|
// _parent_scene.RemoveCharacter(this);
|
||||||
// destroy avatar capsule and related ODE data
|
// destroy avatar capsule and related ODE data
|
||||||
AvatarGeomAndBodyDestroy();
|
AvatarGeomAndBodyDestroy();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// update our local ideia of position velocity and aceleration
|
||||||
|
_position = localpos;
|
||||||
|
_acceleration = _velocity; // previus velocity
|
||||||
|
_velocity = vel;
|
||||||
|
_acceleration = (vel - _acceleration) / timeStep;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates the reported position and velocity. This essentially sends the data up to ScenePresence.
|
/// Updates the reported position and velocity.
|
||||||
|
/// Used to copy variables from unmanaged space at heartbeat rate and also trigger scene updates acording
|
||||||
|
/// also outbounds checking
|
||||||
|
/// copy and outbounds now done in move(..) at ode rate
|
||||||
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void UpdatePositionAndVelocity()
|
public void UpdatePositionAndVelocity()
|
||||||
{
|
{
|
||||||
// no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit!
|
return;
|
||||||
if (Body == IntPtr.Zero)
|
|
||||||
return;
|
|
||||||
|
|
||||||
d.Vector3 vec;
|
// if (Body == IntPtr.Zero)
|
||||||
try
|
// return;
|
||||||
{
|
|
||||||
d.BodyCopyPosition(Body, out vec);
|
|
||||||
}
|
|
||||||
catch (NullReferenceException)
|
|
||||||
{
|
|
||||||
bad = true;
|
|
||||||
_parent_scene.BadCharacter(this);
|
|
||||||
vec = new d.Vector3(_position.X, _position.Y, _position.Z);
|
|
||||||
base.RaiseOutOfBounds(_position); // Tells ScenePresence that there's a problem!
|
|
||||||
m_log.WarnFormat("[ODEPLUGIN]: Avatar Null reference for Avatar {0}, physical actor {1}", m_name, m_uuid);
|
|
||||||
}
|
|
||||||
|
|
||||||
_position.X = vec.X;
|
|
||||||
_position.Y = vec.Y;
|
|
||||||
_position.Z = vec.Z;
|
|
||||||
|
|
||||||
bool fixbody = false;
|
|
||||||
|
|
||||||
if (_position.X < 0.0f)
|
|
||||||
{
|
|
||||||
fixbody = true;
|
|
||||||
_position.X = 0.1f;
|
|
||||||
}
|
|
||||||
else if (_position.X > (int)_parent_scene.WorldExtents.X - 0.1f)
|
|
||||||
{
|
|
||||||
fixbody = true;
|
|
||||||
_position.X = (int)_parent_scene.WorldExtents.X - 0.1f;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_position.Y < 0.0f)
|
|
||||||
{
|
|
||||||
fixbody = true;
|
|
||||||
_position.Y = 0.1f;
|
|
||||||
}
|
|
||||||
else if (_position.Y > (int)_parent_scene.WorldExtents.Y - 0.1)
|
|
||||||
{
|
|
||||||
fixbody = true;
|
|
||||||
_position.Y = (int)_parent_scene.WorldExtents.Y - 0.1f;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fixbody)
|
|
||||||
d.BodySetPosition(Body, _position.X, _position.Y, _position.Z);
|
|
||||||
|
|
||||||
// Did we move last? = zeroflag
|
|
||||||
// This helps keep us from sliding all over
|
|
||||||
/*
|
|
||||||
if (_zeroFlag)
|
|
||||||
{
|
|
||||||
_velocity.X = 0.0f;
|
|
||||||
_velocity.Y = 0.0f;
|
|
||||||
_velocity.Z = 0.0f;
|
|
||||||
|
|
||||||
// Did we send out the 'stopped' message?
|
|
||||||
if (!m_lastUpdateSent)
|
|
||||||
{
|
|
||||||
m_lastUpdateSent = true;
|
|
||||||
base.RequestPhysicsterseUpdate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_lastUpdateSent = false;
|
|
||||||
*/
|
|
||||||
try
|
|
||||||
{
|
|
||||||
vec = d.BodyGetLinearVel(Body);
|
|
||||||
}
|
|
||||||
catch (NullReferenceException)
|
|
||||||
{
|
|
||||||
vec.X = _velocity.X;
|
|
||||||
vec.Y = _velocity.Y;
|
|
||||||
vec.Z = _velocity.Z;
|
|
||||||
}
|
|
||||||
_velocity.X = (vec.X);
|
|
||||||
_velocity.Y = (vec.Y);
|
|
||||||
_velocity.Z = (vec.Z);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1245,7 +1171,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
CAPSULE_LENGTH = caplen;
|
CAPSULE_LENGTH = caplen;
|
||||||
|
|
||||||
AvatarGeomAndBodyCreation(_position.X, _position.Y,
|
AvatarGeomAndBodyCreation(_position.X, _position.Y,
|
||||||
_position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2));
|
_position.Z + (CAPSULE_LENGTH - prevCapsule) * 0.5f);
|
||||||
|
|
||||||
Velocity = Vector3.Zero;
|
Velocity = Vector3.Zero;
|
||||||
|
|
||||||
|
|
|
@ -3228,17 +3228,13 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
{
|
{
|
||||||
if (!childPrim && m_isphysical && Body != IntPtr.Zero &&
|
if (!childPrim && m_isphysical && Body != IntPtr.Zero &&
|
||||||
!m_disabled && !m_isSelected && !m_building && !m_outbounds)
|
!m_disabled && !m_isSelected && !m_building && !m_outbounds)
|
||||||
// !m_disabled && !m_isSelected && !m_building && !m_outbounds)
|
|
||||||
{
|
{
|
||||||
// if (!d.BodyIsEnabled(Body)) d.BodyEnable(Body); // KF add 161009
|
|
||||||
|
|
||||||
if (d.BodyIsEnabled(Body))
|
if (d.BodyIsEnabled(Body))
|
||||||
{
|
{
|
||||||
float timestep = _parent_scene.ODE_STEPSIZE;
|
float timestep = _parent_scene.ODE_STEPSIZE;
|
||||||
|
|
||||||
// check outside region
|
// check outside region
|
||||||
d.Vector3 lpos;
|
d.Vector3 lpos = d.GeomGetPosition(prim_geom); // root position that is seem by rest of simulator
|
||||||
d.GeomCopyPosition(prim_geom, out lpos); // root position that is seem by rest of simulator
|
|
||||||
|
|
||||||
if (lpos.Z < -100 || lpos.Z > 100000f)
|
if (lpos.Z < -100 || lpos.Z > 100000f)
|
||||||
{
|
{
|
||||||
|
@ -3321,12 +3317,9 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
{
|
{
|
||||||
// 'VEHICLES' are dealt with in ODEDynamics.cs
|
// 'VEHICLES' are dealt with in ODEDynamics.cs
|
||||||
m_vehicle.Step();
|
m_vehicle.Step();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
float fx = 0;
|
float fx = 0;
|
||||||
float fy = 0;
|
float fy = 0;
|
||||||
float fz = 0;
|
float fz = 0;
|
||||||
|
@ -3512,10 +3505,39 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
{
|
{
|
||||||
d.BodyAddTorque(Body, trq.X, trq.Y, trq.Z);
|
d.BodyAddTorque(Body, trq.X, trq.Y, trq.Z);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// update our ideia of velocities and acelerations
|
||||||
|
d.Quaternion ori;
|
||||||
|
d.Vector3 dtmpu;
|
||||||
|
|
||||||
|
_position.X = lpos.X;
|
||||||
|
_position.Y = lpos.Y;
|
||||||
|
_position.Z = lpos.Z;
|
||||||
|
|
||||||
|
d.GeomCopyQuaternion(prim_geom, out ori);
|
||||||
|
_orientation.X = ori.X;
|
||||||
|
_orientation.Y = ori.Y;
|
||||||
|
_orientation.Z = ori.Z;
|
||||||
|
_orientation.W = ori.W;
|
||||||
|
|
||||||
|
_acceleration = _velocity;
|
||||||
|
|
||||||
|
dtmpu = d.BodyGetLinearVel(Body);
|
||||||
|
_velocity.X = dtmpu.X;
|
||||||
|
_velocity.Y = dtmpu.Y;
|
||||||
|
_velocity.Z = dtmpu.Z;
|
||||||
|
|
||||||
|
float invts = 1 / timestep;
|
||||||
|
_acceleration = (_velocity - _acceleration) * invts;
|
||||||
|
|
||||||
|
dtmpu = d.BodyGetAngularVel(Body);
|
||||||
|
m_rotationalVelocity.X = dtmpu.X;
|
||||||
|
m_rotationalVelocity.Y = dtmpu.Y;
|
||||||
|
m_rotationalVelocity.Z = dtmpu.Z;
|
||||||
}
|
}
|
||||||
else // body disabled
|
|
||||||
|
else // body disabled/sleeping
|
||||||
{
|
{
|
||||||
// let vehicles sleep
|
// let vehicles sleep
|
||||||
if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE)
|
if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE)
|
||||||
|
@ -3546,36 +3568,23 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
{
|
{
|
||||||
if (Body != IntPtr.Zero)
|
if (Body != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
Vector3 pv = Vector3.Zero;
|
|
||||||
bool lastZeroFlag = _zeroFlag;
|
bool lastZeroFlag = _zeroFlag;
|
||||||
|
|
||||||
d.Vector3 lpos;
|
if ((Math.Abs(m_lastposition.X - _position.X) < 0.01)
|
||||||
d.GeomCopyPosition(prim_geom, out lpos); // root position that is seem by rest of simulator
|
&& (Math.Abs(m_lastposition.Y - _position.Y) < 0.01)
|
||||||
|
&& (Math.Abs(m_lastposition.Z - _position.Z) < 0.01)
|
||||||
|
&& (Math.Abs(m_lastorientation.X - _orientation.X) < 0.0001)
|
||||||
d.Quaternion ori;
|
&& (Math.Abs(m_lastorientation.Y - _orientation.Y) < 0.0001)
|
||||||
d.GeomCopyQuaternion(prim_geom, out ori);
|
&& (Math.Abs(m_lastorientation.Z - _orientation.Z) < 0.0001)
|
||||||
d.Vector3 vel = d.BodyGetLinearVel(Body);
|
|
||||||
d.Vector3 rotvel = d.BodyGetAngularVel(Body);
|
|
||||||
|
|
||||||
if ((Math.Abs(m_lastposition.X - lpos.X) < 0.01)
|
|
||||||
&& (Math.Abs(m_lastposition.Y - lpos.Y) < 0.01)
|
|
||||||
&& (Math.Abs(m_lastposition.Z - lpos.Z) < 0.01)
|
|
||||||
&& (Math.Abs(m_lastorientation.X - ori.X) < 0.0001)
|
|
||||||
&& (Math.Abs(m_lastorientation.Y - ori.Y) < 0.0001)
|
|
||||||
&& (Math.Abs(m_lastorientation.Z - ori.Z) < 0.0001)
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
_zeroFlag = true;
|
_zeroFlag = true;
|
||||||
//Console.WriteLine("ZFT 2");
|
|
||||||
m_throttleUpdates = false;
|
m_throttleUpdates = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//m_log.Debug(Math.Abs(m_lastposition.X - l_position.X).ToString());
|
|
||||||
_zeroFlag = false;
|
_zeroFlag = false;
|
||||||
m_lastUpdateSent = false;
|
m_lastUpdateSent = false;
|
||||||
//m_throttleUpdates = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_zeroFlag)
|
if (_zeroFlag)
|
||||||
|
@ -3583,22 +3592,14 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
m_lastposition = _position;
|
m_lastposition = _position;
|
||||||
m_lastorientation = _orientation;
|
m_lastorientation = _orientation;
|
||||||
|
|
||||||
_velocity.X = 0.0f;
|
_velocity = Vector3.Zero;
|
||||||
_velocity.Y = 0.0f;
|
_acceleration = Vector3.Zero;
|
||||||
_velocity.Z = 0.0f;
|
m_rotationalVelocity = Vector3.Zero;
|
||||||
|
|
||||||
_acceleration.X = 0;
|
|
||||||
_acceleration.Y = 0;
|
|
||||||
_acceleration.Z = 0;
|
|
||||||
|
|
||||||
m_rotationalVelocity.X = 0;
|
|
||||||
m_rotationalVelocity.Y = 0;
|
|
||||||
m_rotationalVelocity.Z = 0;
|
|
||||||
if (!m_lastUpdateSent)
|
if (!m_lastUpdateSent)
|
||||||
{
|
{
|
||||||
m_throttleUpdates = false;
|
m_throttleUpdates = false;
|
||||||
throttleCounter = 0;
|
throttleCounter = 0;
|
||||||
m_rotationalVelocity = pv;
|
|
||||||
|
|
||||||
base.RequestPhysicsterseUpdate();
|
base.RequestPhysicsterseUpdate();
|
||||||
|
|
||||||
|
@ -3612,39 +3613,12 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
base.RequestPhysicsterseUpdate();
|
base.RequestPhysicsterseUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_lastVelocity = _velocity;
|
|
||||||
|
|
||||||
_position.X = lpos.X;
|
|
||||||
_position.Y = lpos.Y;
|
|
||||||
_position.Z = lpos.Z;
|
|
||||||
|
|
||||||
_velocity.X = vel.X;
|
|
||||||
_velocity.Y = vel.Y;
|
|
||||||
_velocity.Z = vel.Z;
|
|
||||||
|
|
||||||
_orientation.X = ori.X;
|
|
||||||
_orientation.Y = ori.Y;
|
|
||||||
_orientation.Z = ori.Z;
|
|
||||||
_orientation.W = ori.W;
|
|
||||||
|
|
||||||
_acceleration = ((_velocity - m_lastVelocity) / simulatedtime);
|
|
||||||
|
|
||||||
if (m_rotationalVelocity.ApproxEquals(pv, 0.0001f))
|
|
||||||
{
|
|
||||||
m_rotationalVelocity = pv;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_rotationalVelocity.X = rotvel.X;
|
|
||||||
m_rotationalVelocity.Y = rotvel.Y;
|
|
||||||
m_rotationalVelocity.Z = rotvel.Z;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_lastUpdateSent = false;
|
m_lastUpdateSent = false;
|
||||||
if (!m_throttleUpdates || throttleCounter > _parent_scene.geomUpdatesPerThrottledUpdate)
|
if (!m_throttleUpdates || throttleCounter > _parent_scene.geomUpdatesPerThrottledUpdate)
|
||||||
{
|
{
|
||||||
m_lastposition = _position;
|
m_lastposition = _position;
|
||||||
m_lastorientation = _orientation;
|
m_lastorientation = _orientation;
|
||||||
|
m_lastVelocity = _velocity;
|
||||||
base.RequestPhysicsterseUpdate();
|
base.RequestPhysicsterseUpdate();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -3656,17 +3630,11 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
else if (!m_lastUpdateSent || !_zeroFlag)
|
else if (!m_lastUpdateSent || !_zeroFlag)
|
||||||
{
|
{
|
||||||
// Not a body.. so Make sure the client isn't interpolating
|
// Not a body.. so Make sure the client isn't interpolating
|
||||||
_velocity.X = 0;
|
_velocity = Vector3.Zero;
|
||||||
_velocity.Y = 0;
|
_acceleration = Vector3.Zero;
|
||||||
_velocity.Z = 0;
|
m_rotationalVelocity = Vector3.Zero;
|
||||||
|
m_lastVelocity = Vector3.Zero;
|
||||||
|
|
||||||
_acceleration.X = 0;
|
|
||||||
_acceleration.Y = 0;
|
|
||||||
_acceleration.Z = 0;
|
|
||||||
|
|
||||||
m_rotationalVelocity.X = 0;
|
|
||||||
m_rotationalVelocity.Y = 0;
|
|
||||||
m_rotationalVelocity.Z = 0;
|
|
||||||
_zeroFlag = true;
|
_zeroFlag = true;
|
||||||
|
|
||||||
if (!m_lastUpdateSent)
|
if (!m_lastUpdateSent)
|
||||||
|
|
|
@ -455,15 +455,15 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
geomDefaultDensity = physicsconfig.GetFloat("geometry_default_density", geomDefaultDensity);
|
geomDefaultDensity = physicsconfig.GetFloat("geometry_default_density", geomDefaultDensity);
|
||||||
bodyFramesAutoDisable = physicsconfig.GetInt("body_frames_auto_disable", bodyFramesAutoDisable);
|
bodyFramesAutoDisable = physicsconfig.GetInt("body_frames_auto_disable", bodyFramesAutoDisable);
|
||||||
|
/*
|
||||||
bodyPIDD = physicsconfig.GetFloat("body_pid_derivative", bodyPIDD);
|
bodyPIDD = physicsconfig.GetFloat("body_pid_derivative", bodyPIDD);
|
||||||
bodyPIDG = physicsconfig.GetFloat("body_pid_gain", bodyPIDG);
|
bodyPIDG = physicsconfig.GetFloat("body_pid_gain", bodyPIDG);
|
||||||
|
*/
|
||||||
forceSimplePrimMeshing = physicsconfig.GetBoolean("force_simple_prim_meshing", forceSimplePrimMeshing);
|
forceSimplePrimMeshing = physicsconfig.GetBoolean("force_simple_prim_meshing", forceSimplePrimMeshing);
|
||||||
meshSculptedPrim = physicsconfig.GetBoolean("mesh_sculpted_prim", meshSculptedPrim);
|
meshSculptedPrim = physicsconfig.GetBoolean("mesh_sculpted_prim", meshSculptedPrim);
|
||||||
meshSculptLOD = physicsconfig.GetFloat("mesh_lod", meshSculptLOD);
|
meshSculptLOD = physicsconfig.GetFloat("mesh_lod", meshSculptLOD);
|
||||||
MeshSculptphysicalLOD = physicsconfig.GetFloat("mesh_physical_lod", MeshSculptphysicalLOD);
|
MeshSculptphysicalLOD = physicsconfig.GetFloat("mesh_physical_lod", MeshSculptphysicalLOD);
|
||||||
|
/*
|
||||||
if (Environment.OSVersion.Platform == PlatformID.Unix)
|
if (Environment.OSVersion.Platform == PlatformID.Unix)
|
||||||
{
|
{
|
||||||
avPIDD = physicsconfig.GetFloat("av_pid_derivative_linux", avPIDD);
|
avPIDD = physicsconfig.GetFloat("av_pid_derivative_linux", avPIDD);
|
||||||
|
@ -471,10 +471,11 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
avPIDD = physicsconfig.GetFloat("av_pid_derivative_win", avPIDD);
|
avPIDD = physicsconfig.GetFloat("av_pid_derivative_win", avPIDD);
|
||||||
avPIDP = physicsconfig.GetFloat("av_pid_proportional_win", avPIDP);
|
avPIDP = physicsconfig.GetFloat("av_pid_proportional_win", avPIDP);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
physics_logging = physicsconfig.GetBoolean("physics_logging", false);
|
physics_logging = physicsconfig.GetBoolean("physics_logging", false);
|
||||||
physics_logging_interval = physicsconfig.GetInt("physics_logging_interval", 0);
|
physics_logging_interval = physicsconfig.GetInt("physics_logging_interval", 0);
|
||||||
physics_logging_append_existing_logfile = physicsconfig.GetBoolean("physics_logging_append_existing_logfile", false);
|
physics_logging_append_existing_logfile = physicsconfig.GetBoolean("physics_logging_append_existing_logfile", false);
|
||||||
|
@ -1860,6 +1861,9 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
statstart = Util.EnvironmentTickCount();
|
statstart = Util.EnvironmentTickCount();
|
||||||
|
|
||||||
|
/*
|
||||||
|
// now included in characters move() and done at ode rate
|
||||||
|
// maybe be needed later if we need to do any extra work at hearbeat rate
|
||||||
lock (_characters)
|
lock (_characters)
|
||||||
{
|
{
|
||||||
foreach (OdeCharacter actor in _characters)
|
foreach (OdeCharacter actor in _characters)
|
||||||
|
@ -1873,7 +1877,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
lock (_badCharacter)
|
lock (_badCharacter)
|
||||||
{
|
{
|
||||||
if (_badCharacter.Count > 0)
|
if (_badCharacter.Count > 0)
|
||||||
|
|
Loading…
Reference in New Issue