* Physical prim cross borders and continue from where the left off on the other side now, assuming the region on the other side has physical prim enabled.

ThreadPoolClientBranch
Teravus Ovares 2008-02-12 07:32:32 +00:00
parent 6e01769bcf
commit e5ede36f0c
5 changed files with 78 additions and 19 deletions

View File

@ -745,7 +745,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Error("[Scene]: Failed with exception " + e.ToString()); m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
} }
finally finally
{ {
@ -1230,32 +1230,32 @@ namespace OpenSim.Region.Environment.Scenes
int thisx = (int)RegionInfo.RegionLocX; int thisx = (int)RegionInfo.RegionLocX;
int thisy = (int)RegionInfo.RegionLocY; int thisy = (int)RegionInfo.RegionLocY;
ulong newRegionHandle = 0; ulong newRegionHandle = 0;
LLVector3 pos = grp.AbsolutePosition; LLVector3 pos = position;
if (position.X > 255.6f) if (position.X > 257f)
{ {
pos.X = ((pos.X - 256) + 10); pos.X = ((pos.X - 256));
newRegionHandle = Util.UIntsToLong((uint)((thisx + 1) * 256), (uint)(thisy * 256)); newRegionHandle = Util.UIntsToLong((uint)((thisx + 1) * 256), (uint)(thisy * 256));
// x + 1 // x + 1
} }
else if (position.X < 0.4f) else if (position.X < -1f)
{ {
pos.X = ((pos.X + 256) - 10); pos.X = ((pos.X + 256));
newRegionHandle = Util.UIntsToLong((uint)((thisx - 1) * 256), (uint)(thisy * 256)); newRegionHandle = Util.UIntsToLong((uint)((thisx - 1) * 256), (uint)(thisy * 256));
// x - 1 // x - 1
} }
if (position.Y > 255.6f) if (position.Y > 257f)
{ {
pos.Y = ((pos.Y - 256) + 10); pos.Y = ((pos.Y - 256));
newRegionHandle = Util.UIntsToLong((uint)(thisx * 256), (uint)((thisy + 1) * 256)); newRegionHandle = Util.UIntsToLong((uint)(thisx * 256), (uint)((thisy + 1) * 256));
// y + 1 // y + 1
} }
else if (position.Y < 0.4f) else if (position.Y < -1f)
{ {
pos.Y = ((pos.Y + 256) - 10); pos.Y = ((pos.Y + 256));
newRegionHandle = Util.UIntsToLong((uint)(thisx * 256), (uint)((thisy - 1) * 256)); newRegionHandle = Util.UIntsToLong((uint)(thisx * 256), (uint)((thisy - 1) * 256));
// y - 1 // y - 1
} }
@ -1287,7 +1287,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
public void IncomingInterRegionPrimGroup(ulong regionHandle, LLUUID primID, string objXMLData) public void IncomingInterRegionPrimGroup(ulong regionHandle, LLUUID primID, string objXMLData)
{ {
m_log.Warn("{[INTERREGION]: OMG! A new prim arrived from a neighbor!.. Kyill eeehht! before it corrupts my entire database! AHHH! I feel so dirty now! yuck! ack! arg!"); m_log.Warn("{[INTERREGION]: A new prim arrived from a neighbor");
m_sceneXmlLoader.LoadGroupFromXml2String(objXMLData); m_sceneXmlLoader.LoadGroupFromXml2String(objXMLData);
} }

View File

@ -126,7 +126,7 @@ namespace OpenSim.Region.Environment.Scenes
set set
{ {
LLVector3 val = value; LLVector3 val = value;
if (val.X > 255.6f || val.X < 0.4f || val.Y > 255.6f || val.Y < 0.4f) if (val.X > 257f || val.X < -1f || val.Y > 257f || val.Y < -1f)
{ {
m_scene.CrossPrimGroupIntoNewRegion(val, this); m_scene.CrossPrimGroupIntoNewRegion(val, this);
} }

View File

@ -405,7 +405,19 @@ namespace OpenSim.Region.Environment.Scenes
return m_velocity; return m_velocity;
} }
set { m_velocity = value; } set {
m_velocity = value;
if (PhysActor != null)
{
if (PhysActor.IsPhysical)
{
PhysActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z);
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
}
}
}
} }
public LLVector3 RotationalVelocity public LLVector3 RotationalVelocity
@ -742,6 +754,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart)); XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart));
SceneObjectPart newobject = (SceneObjectPart) serializer.Deserialize(xmlReader); SceneObjectPart newobject = (SceneObjectPart) serializer.Deserialize(xmlReader);
return newobject; return newobject;
} }
@ -1776,6 +1789,16 @@ namespace OpenSim.Region.Environment.Scenes
public void PhysicsRequestingTerseUpdate() public void PhysicsRequestingTerseUpdate()
{ {
if (PhysActor != null)
{
LLVector3 newpos = new LLVector3(PhysActor.Position.GetBytes(), 0);
if (newpos.X > 257f || newpos.X < -1f || newpos.Y > 257f || newpos.Y < -1f)
{
m_parentGroup.AbsolutePosition = newpos;
return;
}
}
ScheduleTerseUpdate(); ScheduleTerseUpdate();
//SendTerseUpdateToAllClients(); //SendTerseUpdateToAllClients();

View File

@ -175,6 +175,8 @@ namespace OpenSim.Region.Environment.Scenes
public void CreatePrimFromXml(string xmlData) public void CreatePrimFromXml(string xmlData)
{ {
SceneObjectGroup obj = new SceneObjectGroup(xmlData); SceneObjectGroup obj = new SceneObjectGroup(xmlData);
LLVector3 receivedVelocity = obj.RootPart.Velocity;
//System.Console.WriteLine(obj.RootPart.Velocity.ToString());
m_innerScene.AddEntityFromStorage(obj); m_innerScene.AddEntityFromStorage(obj);
SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); SceneObjectPart rootPart = obj.GetChildPart(obj.UUID);
@ -191,6 +193,8 @@ namespace OpenSim.Region.Environment.Scenes
new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics); rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics);
rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
rootPart.Velocity = receivedVelocity;
} }
} }

View File

@ -49,6 +49,7 @@ namespace OpenSim.Region.Physics.OdePlugin
private Quaternion _orientation; private Quaternion _orientation;
private PhysicsVector m_taintposition; private PhysicsVector m_taintposition;
private PhysicsVector m_taintsize; private PhysicsVector m_taintsize;
private PhysicsVector m_taintVelocity = PhysicsVector.Zero;
private Quaternion m_taintrot; private Quaternion m_taintrot;
private bool m_taintshape = false; private bool m_taintshape = false;
private bool m_taintPhysics = false; private bool m_taintPhysics = false;
@ -455,8 +456,13 @@ namespace OpenSim.Region.Physics.OdePlugin
if (m_taintdisable) if (m_taintdisable)
changedisable(timestep); changedisable(timestep);
if (m_taintVelocity != PhysicsVector.Zero)
changevelocity(timestep);
} }
public void Move(float timestep) public void Move(float timestep)
{ {
if (m_isphysical) if (m_isphysical)
@ -743,7 +749,18 @@ namespace OpenSim.Region.Physics.OdePlugin
m_taintforce = false; m_taintforce = false;
} }
private void changevelocity(float timestep)
{
System.Threading.Thread.Sleep(20);
if (IsPhysical)
{
if (Body != (IntPtr)0)
{
d.BodySetLinearVel(Body, m_taintVelocity.X, m_taintVelocity.Y, m_taintVelocity.Z);
}
}
m_taintVelocity = PhysicsVector.Zero;
}
public override bool IsPhysical public override bool IsPhysical
{ {
get { return m_isphysical; } get { return m_isphysical; }
@ -838,7 +855,14 @@ namespace OpenSim.Region.Physics.OdePlugin
returnVelocity.Z = (m_lastVelocity.Z + _velocity.Z)/2; returnVelocity.Z = (m_lastVelocity.Z + _velocity.Z)/2;
return returnVelocity; return returnVelocity;
} }
set { _velocity = value; } set {
_velocity = value;
m_taintVelocity = value;
_parent_scene.AddPhysicsActorTaint(this);
}
} }
public override bool Kinematic public override bool Kinematic
@ -898,16 +922,24 @@ namespace OpenSim.Region.Physics.OdePlugin
d.Vector3 rotvel = d.BodyGetAngularVel(Body); d.Vector3 rotvel = d.BodyGetAngularVel(Body);
PhysicsVector l_position = new PhysicsVector(); PhysicsVector l_position = new PhysicsVector();
// kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!)
if (vec.X < 0.0f) vec.X = 0.0f; //if (vec.X < 0.0f) vec.X = 0.0f;
if (vec.Y < 0.0f) vec.Y = 0.0f; //if (vec.Y < 0.0f) vec.Y = 0.0f;
if (vec.X > 255.95f) vec.X = 255.95f; //if (vec.X > 255.95f) vec.X = 255.95f;
if (vec.Y > 255.95f) vec.Y = 255.95f; //if (vec.Y > 255.95f) vec.Y = 255.95f;
m_lastposition = _position; m_lastposition = _position;
l_position.X = vec.X; l_position.X = vec.X;
l_position.Y = vec.Y; l_position.Y = vec.Y;
l_position.Z = vec.Z; l_position.Z = vec.Z;
if (l_position.X > 257f || l_position.X < -1f || l_position.Y > 257f || l_position.Y < -1f)
{
base.RequestPhysicsterseUpdate();
}
if (l_position.Z < 0) if (l_position.Z < 0)
{ {
// This is so prim that get lost underground don't fall forever and suck up // This is so prim that get lost underground don't fall forever and suck up