From edd50f2e8ea384e1fe9f9dc0ed5903477cb383f3 Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 23 Aug 2007 11:38:50 +0000 Subject: Implemented Resize Method in OdePrim. attached the links to that from SceneObject, so now resizing works (as much as resizing currently works in opensim, fixing resizing in general is on my todo list for today). Rotation of a root prim also now updates the physics engine. So think there really is only deleteprim left, then it should be usable (Different shapes (other than boxes that it currently uses) can wait a little bit longer). [of course there are still the other issues of ODE not really working when there is more than one region in a instance of opensim]. --- OpenSim/Region/Environment/Scenes/Scene.cs | 10 +++++----- OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 19 +++++++++++++++++++ OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 10 +++++++--- 3 files changed, 31 insertions(+), 8 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 20624d5..87a42b1 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -547,7 +547,7 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectGroup sceneOb = new SceneObjectGroup(this, this.m_regionHandle, ownerID, PrimIDAllocate(), pos, shape); AddEntity(sceneOb); SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID); - // rootPart.PhysActor =phyScene.AddPrim(new PhysicsVector(pos.X, pos.Y, pos.Z), new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z), + //rootPart.PhysActor =phyScene.AddPrim(new PhysicsVector(pos.X, pos.Y, pos.Z), new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z), // new Axiom.Math.Quaternion()); } @@ -626,11 +626,11 @@ namespace OpenSim.Region.Environment.Scenes AddEntity(obj); SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); - //rootPart.PhysActor = phyScene.AddPrim( + //rootPart.PhysActor = phyScene.AddPrim( // new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, rootPart.AbsolutePosition.Z), - // new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), - // new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, - // rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); + // new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), + // new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, + // rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); primCount++; } } diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 7e34637..f787190 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -717,6 +717,13 @@ namespace OpenSim.Region.Environment.Scenes if (part != null) { part.Resize(scale); + if (part.UUID == this.m_rootPart.UUID) + { + if (m_rootPart.PhysActor != null) + { + m_rootPart.PhysActor.Size = new PhysicsVector(m_rootPart.Scale.X, m_rootPart.Scale.Y, m_rootPart.Scale.Z); + } + } } } #endregion @@ -789,6 +796,10 @@ namespace OpenSim.Region.Environment.Scenes public void UpdateGroupRotation(LLQuaternion rot) { this.m_rootPart.UpdateRotation(rot); + if (m_rootPart.PhysActor != null) + { + m_rootPart.PhysActor.Orientation = new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z); + } this.ScheduleGroupForTerseUpdate(); } @@ -800,6 +811,10 @@ namespace OpenSim.Region.Environment.Scenes public void UpdateGroupRotation(LLVector3 pos, LLQuaternion rot) { this.m_rootPart.UpdateRotation(rot); + if (m_rootPart.PhysActor != null) + { + m_rootPart.PhysActor.Orientation = new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z); + } this.AbsolutePosition = pos; this.ScheduleGroupForTerseUpdate(); } @@ -832,6 +847,10 @@ namespace OpenSim.Region.Environment.Scenes private void UpdateRootRotation(LLQuaternion rot) { this.m_rootPart.UpdateRotation(rot); + if (m_rootPart.PhysActor != null) + { + m_rootPart.PhysActor.Orientation = new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z); + } Axiom.Math.Quaternion axRot = new Quaternion(rot.W, rot.X, rot.Y, rot.Z); Axiom.Math.Quaternion oldParentRot = new Quaternion(this.m_rootPart.RotationOffset.W, this.m_rootPart.RotationOffset.X, this.m_rootPart.RotationOffset.Y, this.m_rootPart.RotationOffset.Z); diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index ae46feb..f168340 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs @@ -148,7 +148,7 @@ namespace OpenSim.Region.Physics.OdePlugin public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation) { - Console.WriteLine("+++++++++++++++++++++++++++++++++AddPrim pos: " + position + " size: " + size + " quat: " + rotation); + //Console.WriteLine("+++++++++++++++++++++++++++++++++AddPrim pos: " + position + " size: " + size + " quat: " + rotation); PhysicsVector pos = new PhysicsVector(); pos.X = position.X; pos.Y = position.Y; @@ -437,7 +437,7 @@ namespace OpenSim.Region.Physics.OdePlugin } set { - Console.WriteLine("+++++++++++++++++++++++++++++++++++++++++++ setting pos: " + value); + //Console.WriteLine("+++++++++++++++++++++++++++++++++++++++++++ setting pos: " + value); _position = value; Monitor.Enter(typeof(OdeScene)); d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); @@ -454,8 +454,11 @@ namespace OpenSim.Region.Physics.OdePlugin } set { - Console.WriteLine("+++++++++++++++++++++++++++++++++++++++++++ setting size: " + value); + //Console.WriteLine("+++++++++++++++++++++++++++++++++++++++++++ setting size: " + value); _size = value; + Monitor.Enter(typeof(OdeScene)); + d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z); + Monitor.Exit(typeof(OdeScene)); } } @@ -490,6 +493,7 @@ namespace OpenSim.Region.Physics.OdePlugin } set { + //Console.WriteLine("+++++++++++++++++++++++++++++++++++++++++++ setting Orientation"); _orientation = value; Monitor.Enter(typeof(OdeScene)); d.Quaternion myrot = new d.Quaternion(); -- cgit v1.1