From e5ede36f0c8974dc81d1755d16513641aff535c2 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Tue, 12 Feb 2008 07:32:32 +0000 Subject: * 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. --- OpenSim/Region/Environment/Scenes/Scene.cs | 22 +++++++++---------- .../Region/Environment/Scenes/SceneObjectGroup.cs | 2 +- .../Region/Environment/Scenes/SceneObjectPart.cs | 25 +++++++++++++++++++++- .../Region/Environment/Scenes/SceneXmlLoader.cs | 4 ++++ 4 files changed, 40 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index b797cc3..ba2a2cf 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -745,7 +745,7 @@ namespace OpenSim.Region.Environment.Scenes } 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 { @@ -1230,32 +1230,32 @@ namespace OpenSim.Region.Environment.Scenes int thisx = (int)RegionInfo.RegionLocX; int thisy = (int)RegionInfo.RegionLocY; 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)); // 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)); // 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)); // 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)); // y - 1 } @@ -1287,7 +1287,7 @@ namespace OpenSim.Region.Environment.Scenes } 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); } diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 3b146ea..117bcbc 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -126,7 +126,7 @@ namespace OpenSim.Region.Environment.Scenes set { 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); } diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 7900900..4f5eefe 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -405,7 +405,19 @@ namespace OpenSim.Region.Environment.Scenes 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 @@ -742,6 +754,7 @@ namespace OpenSim.Region.Environment.Scenes { XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart)); SceneObjectPart newobject = (SceneObjectPart) serializer.Deserialize(xmlReader); + return newobject; } @@ -1776,6 +1789,16 @@ namespace OpenSim.Region.Environment.Scenes 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(); //SendTerseUpdateToAllClients(); diff --git a/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs b/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs index 6d911f1..4982613 100644 --- a/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs +++ b/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs @@ -175,6 +175,8 @@ namespace OpenSim.Region.Environment.Scenes public void CreatePrimFromXml(string xmlData) { SceneObjectGroup obj = new SceneObjectGroup(xmlData); + LLVector3 receivedVelocity = obj.RootPart.Velocity; + //System.Console.WriteLine(obj.RootPart.Velocity.ToString()); m_innerScene.AddEntityFromStorage(obj); SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); @@ -191,6 +193,8 @@ namespace OpenSim.Region.Environment.Scenes new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics); rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); + rootPart.Velocity = receivedVelocity; + } } -- cgit v1.1