diff options
Diffstat (limited to 'OpenSim/Region/Physics')
20 files changed, 226 insertions, 260 deletions
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs index 3bf0956..e38a12b 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs | |||
@@ -26,8 +26,8 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using Axiom.Math; | ||
30 | using Nini.Config; | 29 | using Nini.Config; |
30 | using OpenMetaverse; | ||
31 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
32 | using OpenSim.Region.Physics.Manager; | 32 | using OpenSim.Region.Physics.Manager; |
33 | 33 | ||
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs index cc55f6e..c969f9a 100644 --- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs +++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs | |||
@@ -29,13 +29,15 @@ | |||
29 | 29 | ||
30 | using System; | 30 | using System; |
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using OpenMetaverse; | ||
32 | using MonoXnaCompactMaths; | 33 | using MonoXnaCompactMaths; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
34 | using OpenSim.Region.Physics.Manager; | 35 | using OpenSim.Region.Physics.Manager; |
35 | using XnaDevRu.BulletX; | 36 | using XnaDevRu.BulletX; |
36 | using XnaDevRu.BulletX.Dynamics; | 37 | using XnaDevRu.BulletX.Dynamics; |
37 | using Nini.Config; | 38 | using Nini.Config; |
38 | using AxiomQuaternion = Axiom.Math.Quaternion; | 39 | using Vector3 = MonoXnaCompactMaths.Vector3; |
40 | using Quaternion = MonoXnaCompactMaths.Quaternion; | ||
39 | 41 | ||
40 | #endregion | 42 | #endregion |
41 | 43 | ||
@@ -61,14 +63,14 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
61 | } | 63 | } |
62 | 64 | ||
63 | //Quaternion | 65 | //Quaternion |
64 | public static Quaternion AxiomQuaternionToXnaQuaternion(AxiomQuaternion axiomQuaternion) | 66 | public static Quaternion QuaternionToXnaQuaternion(OpenMetaverse.Quaternion quaternion) |
65 | { | 67 | { |
66 | return new Quaternion(axiomQuaternion.x, axiomQuaternion.y, axiomQuaternion.z, axiomQuaternion.w); | 68 | return new Quaternion(quaternion.X, quaternion.Y, quaternion.Z, quaternion.W); |
67 | } | 69 | } |
68 | 70 | ||
69 | public static AxiomQuaternion XnaQuaternionToAxiomQuaternion(Quaternion xnaQuaternion) | 71 | public static OpenMetaverse.Quaternion XnaQuaternionToQuaternion(Quaternion xnaQuaternion) |
70 | { | 72 | { |
71 | return new AxiomQuaternion(xnaQuaternion.W, xnaQuaternion.X, xnaQuaternion.Y, xnaQuaternion.Z); | 73 | return new OpenMetaverse.Quaternion(xnaQuaternion.W, xnaQuaternion.X, xnaQuaternion.Y, xnaQuaternion.Z); |
72 | } | 74 | } |
73 | 75 | ||
74 | //Next methods are extracted from XnaDevRu.BulletX(See 3rd party license): | 76 | //Next methods are extracted from XnaDevRu.BulletX(See 3rd party license): |
@@ -92,7 +94,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
92 | 94 | ||
93 | internal static Quaternion GetRotation(Matrix m) | 95 | internal static Quaternion GetRotation(Matrix m) |
94 | { | 96 | { |
95 | Quaternion q = new Quaternion(); | 97 | Quaternion q; |
96 | 98 | ||
97 | float trace = m.M11 + m.M22 + m.M33; | 99 | float trace = m.M11 + m.M22 + m.M33; |
98 | 100 | ||
@@ -108,6 +110,8 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
108 | } | 110 | } |
109 | else | 111 | else |
110 | { | 112 | { |
113 | q.X = q.Y = q.Z = q.W = 0f; | ||
114 | |||
111 | int i = m.M11 < m.M22 | 115 | int i = m.M11 < m.M22 |
112 | ? | 116 | ? |
113 | (m.M22 < m.M33 ? 2 : 1) | 117 | (m.M22 < m.M33 ? 2 : 1) |
@@ -601,13 +605,13 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
601 | } | 605 | } |
602 | 606 | ||
603 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, | 607 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, |
604 | PhysicsVector size, AxiomQuaternion rotation) | 608 | PhysicsVector size, OpenMetaverse.Quaternion rotation) |
605 | { | 609 | { |
606 | return AddPrimShape(primName, pbs, position, size, rotation, false); | 610 | return AddPrimShape(primName, pbs, position, size, rotation, false); |
607 | } | 611 | } |
608 | 612 | ||
609 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, | 613 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, |
610 | PhysicsVector size, AxiomQuaternion rotation, bool isPhysical) | 614 | PhysicsVector size, OpenMetaverse.Quaternion rotation, bool isPhysical) |
611 | { | 615 | { |
612 | PhysicsActor result; | 616 | PhysicsActor result; |
613 | 617 | ||
@@ -634,7 +638,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
634 | return result; | 638 | return result; |
635 | } | 639 | } |
636 | 640 | ||
637 | public PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, AxiomQuaternion rotation, | 641 | public PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, OpenMetaverse.Quaternion rotation, |
638 | IMesh mesh, PrimitiveBaseShape pbs, bool isPhysical) | 642 | IMesh mesh, PrimitiveBaseShape pbs, bool isPhysical) |
639 | { | 643 | { |
640 | BulletXPrim newPrim = null; | 644 | BulletXPrim newPrim = null; |
@@ -680,7 +684,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
680 | //Try to remove garbage | 684 | //Try to remove garbage |
681 | RemoveForgottenRigidBodies(); | 685 | RemoveForgottenRigidBodies(); |
682 | //End of remove | 686 | //End of remove |
683 | MoveAllObjects(timeStep); | 687 | MoveAPrimitives(timeStep); |
684 | 688 | ||
685 | 689 | ||
686 | fps = (timeStep*simulationSubSteps); | 690 | fps = (timeStep*simulationSubSteps); |
@@ -694,7 +698,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
694 | return fps; | 698 | return fps; |
695 | } | 699 | } |
696 | 700 | ||
697 | private void MoveAllObjects(float timeStep) | 701 | private void MoveAPrimitives(float timeStep) |
698 | { | 702 | { |
699 | foreach (BulletXCharacter actor in _characters.Values) | 703 | foreach (BulletXCharacter actor in _characters.Values) |
700 | { | 704 | { |
@@ -867,7 +871,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
867 | protected PhysicsVector _velocity; | 871 | protected PhysicsVector _velocity; |
868 | protected PhysicsVector _size; | 872 | protected PhysicsVector _size; |
869 | protected PhysicsVector _acceleration; | 873 | protected PhysicsVector _acceleration; |
870 | protected AxiomQuaternion _orientation; | 874 | protected OpenMetaverse.Quaternion _orientation; |
871 | protected PhysicsVector m_rotationalVelocity = PhysicsVector.Zero; | 875 | protected PhysicsVector m_rotationalVelocity = PhysicsVector.Zero; |
872 | protected RigidBody rigidBody; | 876 | protected RigidBody rigidBody; |
873 | protected int m_PhysicsActorType; | 877 | protected int m_PhysicsActorType; |
@@ -972,7 +976,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
972 | get { return _acceleration; } | 976 | get { return _acceleration; } |
973 | } | 977 | } |
974 | 978 | ||
975 | public override AxiomQuaternion Orientation | 979 | public override OpenMetaverse.Quaternion Orientation |
976 | { | 980 | { |
977 | get { return _orientation; } | 981 | get { return _orientation; } |
978 | set | 982 | set |
@@ -1148,10 +1152,10 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1148 | ReOrient(_orientation); | 1152 | ReOrient(_orientation); |
1149 | } | 1153 | } |
1150 | 1154 | ||
1151 | protected internal void ReOrient(AxiomQuaternion _newOrient) | 1155 | protected internal void ReOrient(OpenMetaverse.Quaternion _newOrient) |
1152 | { | 1156 | { |
1153 | Quaternion _newOrientation; | 1157 | Quaternion _newOrientation; |
1154 | _newOrientation = BulletXMaths.AxiomQuaternionToXnaQuaternion(_newOrient); | 1158 | _newOrientation = BulletXMaths.QuaternionToXnaQuaternion(_newOrient); |
1155 | Matrix _comTransform = rigidBody.CenterOfMassTransform; | 1159 | Matrix _comTransform = rigidBody.CenterOfMassTransform; |
1156 | BulletXMaths.SetRotation(ref _comTransform, _newOrientation); | 1160 | BulletXMaths.SetRotation(ref _comTransform, _newOrientation); |
1157 | rigidBody.CenterOfMassTransform = _comTransform; | 1161 | rigidBody.CenterOfMassTransform = _comTransform; |
@@ -1206,12 +1210,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1206 | 1210 | ||
1207 | public BulletXCharacter(String avName, BulletXScene parent_scene, PhysicsVector pos) | 1211 | public BulletXCharacter(String avName, BulletXScene parent_scene, PhysicsVector pos) |
1208 | : this(avName, parent_scene, pos, new PhysicsVector(), new PhysicsVector(), new PhysicsVector(), | 1212 | : this(avName, parent_scene, pos, new PhysicsVector(), new PhysicsVector(), new PhysicsVector(), |
1209 | AxiomQuaternion.Identity) | 1213 | OpenMetaverse.Quaternion.Identity) |
1210 | { | 1214 | { |
1211 | } | 1215 | } |
1212 | 1216 | ||
1213 | public BulletXCharacter(String avName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector velocity, | 1217 | public BulletXCharacter(String avName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector velocity, |
1214 | PhysicsVector size, PhysicsVector acceleration, AxiomQuaternion orientation) | 1218 | PhysicsVector size, PhysicsVector acceleration, OpenMetaverse.Quaternion orientation) |
1215 | : base(avName) | 1219 | : base(avName) |
1216 | { | 1220 | { |
1217 | //This fields will be removed. They're temporal | 1221 | //This fields will be removed. They're temporal |
@@ -1289,7 +1293,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1289 | get { return base.Acceleration; } | 1293 | get { return base.Acceleration; } |
1290 | } | 1294 | } |
1291 | 1295 | ||
1292 | public override AxiomQuaternion Orientation | 1296 | public override OpenMetaverse.Quaternion Orientation |
1293 | { | 1297 | { |
1294 | get { return base.Orientation; } | 1298 | get { return base.Orientation; } |
1295 | set { base.Orientation = value; } | 1299 | set { base.Orientation = value; } |
@@ -1404,7 +1408,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1404 | 1408 | ||
1405 | 1409 | ||
1406 | public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector size, | 1410 | public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector size, |
1407 | AxiomQuaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool isPhysical) | 1411 | OpenMetaverse.Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool isPhysical) |
1408 | : this( | 1412 | : this( |
1409 | primName, parent_scene, pos, new PhysicsVector(), size, new PhysicsVector(), rotation, mesh, pbs, | 1413 | primName, parent_scene, pos, new PhysicsVector(), size, new PhysicsVector(), rotation, mesh, pbs, |
1410 | isPhysical) | 1414 | isPhysical) |
@@ -1413,12 +1417,14 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1413 | 1417 | ||
1414 | public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector velocity, | 1418 | public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector velocity, |
1415 | PhysicsVector size, | 1419 | PhysicsVector size, |
1416 | PhysicsVector acceleration, AxiomQuaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, | 1420 | PhysicsVector acceleration, OpenMetaverse.Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, |
1417 | bool isPhysical) | 1421 | bool isPhysical) |
1418 | : base(primName) | 1422 | : base(primName) |
1419 | { | 1423 | { |
1420 | if ((size.X == 0) || (size.Y == 0) || (size.Z == 0)) throw new Exception("Size 0"); | 1424 | if ((size.X == 0) || (size.Y == 0) || (size.Z == 0)) |
1421 | if (rotation.Norm == 0f) rotation = AxiomQuaternion.Identity; | 1425 | throw new Exception("Size 0"); |
1426 | if (OpenMetaverse.Quaternion.Normalize(rotation).Length() == 0f) | ||
1427 | rotation = OpenMetaverse.Quaternion.Identity; | ||
1422 | 1428 | ||
1423 | _position = pos; | 1429 | _position = pos; |
1424 | _physical = isPhysical; | 1430 | _physical = isPhysical; |
@@ -1468,7 +1474,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1468 | get { return base.Acceleration; } | 1474 | get { return base.Acceleration; } |
1469 | } | 1475 | } |
1470 | 1476 | ||
1471 | public override AxiomQuaternion Orientation | 1477 | public override OpenMetaverse.Quaternion Orientation |
1472 | { | 1478 | { |
1473 | get { return base.Orientation; } | 1479 | get { return base.Orientation; } |
1474 | set { base.Orientation = value; } | 1480 | set { base.Orientation = value; } |
@@ -1565,7 +1571,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1565 | _position = BulletXMaths.XnaVector3ToPhysicsVector(rigidBody.CenterOfMassPosition); | 1571 | _position = BulletXMaths.XnaVector3ToPhysicsVector(rigidBody.CenterOfMassPosition); |
1566 | 1572 | ||
1567 | _velocity = BulletXMaths.XnaVector3ToPhysicsVector(rigidBody.LinearVelocity); | 1573 | _velocity = BulletXMaths.XnaVector3ToPhysicsVector(rigidBody.LinearVelocity); |
1568 | _orientation = BulletXMaths.XnaQuaternionToAxiomQuaternion(rigidBody.Orientation); | 1574 | _orientation = BulletXMaths.XnaQuaternionToQuaternion(rigidBody.Orientation); |
1569 | 1575 | ||
1570 | if ((Math.Abs(m_prev_position.X - _position.X) < 0.03) | 1576 | if ((Math.Abs(m_prev_position.X - _position.X) < 0.03) |
1571 | && (Math.Abs(m_prev_position.Y - _position.Y) < 0.03) | 1577 | && (Math.Abs(m_prev_position.Y - _position.Y) < 0.03) |
@@ -1687,7 +1693,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1687 | { | 1693 | { |
1688 | private PhysicsVector _staticPosition; | 1694 | private PhysicsVector _staticPosition; |
1689 | // private PhysicsVector _staticVelocity; | 1695 | // private PhysicsVector _staticVelocity; |
1690 | // private AxiomQuaternion _staticOrientation; | 1696 | // private OpenMetaverse.Quaternion _staticOrientation; |
1691 | private float _mass; | 1697 | private float _mass; |
1692 | // private BulletXScene _parentscene; | 1698 | // private BulletXScene _parentscene; |
1693 | internal float[] _heightField; | 1699 | internal float[] _heightField; |
@@ -1702,7 +1708,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1702 | { | 1708 | { |
1703 | _staticPosition = new PhysicsVector(BulletXScene.MaxXY/2, BulletXScene.MaxXY/2, 0); | 1709 | _staticPosition = new PhysicsVector(BulletXScene.MaxXY/2, BulletXScene.MaxXY/2, 0); |
1704 | // _staticVelocity = new PhysicsVector(); | 1710 | // _staticVelocity = new PhysicsVector(); |
1705 | // _staticOrientation = AxiomQuaternion.Identity; | 1711 | // _staticOrientation = OpenMetaverse.Quaternion.Identity; |
1706 | _mass = 0; //No active | 1712 | _mass = 0; //No active |
1707 | // _parentscene = parent_scene; | 1713 | // _parentscene = parent_scene; |
1708 | _heightField = heightField; | 1714 | _heightField = heightField; |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index d4af271..482b478 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs | |||
@@ -27,8 +27,8 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using Axiom.Math; | ||
31 | using OpenSim.Framework; | 30 | using OpenSim.Framework; |
31 | using OpenMetaverse; | ||
32 | 32 | ||
33 | namespace OpenSim.Region.Physics.Manager | 33 | namespace OpenSim.Region.Physics.Manager |
34 | { | 34 | { |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs index 3d9207f..db41251 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs | |||
@@ -115,43 +115,73 @@ namespace OpenSim.Region.Physics.Manager | |||
115 | // that the LoadFrom context be avoided. This can be done by installing assemblies in the | 115 | // that the LoadFrom context be avoided. This can be done by installing assemblies in the |
116 | // Global Assembly Cache or in the ApplicationBase directory and using Assembly. | 116 | // Global Assembly Cache or in the ApplicationBase directory and using Assembly. |
117 | // Load when explicitly loading assemblies. | 117 | // Load when explicitly loading assemblies. |
118 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); | 118 | Assembly pluginAssembly = null; |
119 | Type[] types = null; | ||
119 | 120 | ||
120 | foreach (Type pluginType in pluginAssembly.GetTypes()) | 121 | try |
121 | { | 122 | { |
122 | if (pluginType.IsPublic) | 123 | pluginAssembly = Assembly.LoadFrom(FileName); |
123 | { | 124 | } |
124 | if (!pluginType.IsAbstract) | 125 | catch (Exception ex) |
125 | { | 126 | { |
126 | Type physTypeInterface = pluginType.GetInterface("IPhysicsPlugin", true); | 127 | m_log.Error("Failed to load plugin from " + FileName, ex); |
127 | 128 | } | |
128 | if (physTypeInterface != null) | ||
129 | { | ||
130 | IPhysicsPlugin plug = | ||
131 | (IPhysicsPlugin) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
132 | plug.Init(); | ||
133 | if (!_PhysPlugins.ContainsKey(plug.GetName())) | ||
134 | { | ||
135 | _PhysPlugins.Add(plug.GetName(), plug); | ||
136 | m_log.Info("[PHYSICS]: Added physics engine: " + plug.GetName()); | ||
137 | } | ||
138 | } | ||
139 | 129 | ||
140 | Type meshTypeInterface = pluginType.GetInterface("IMeshingPlugin", true); | 130 | if (pluginAssembly != null) |
131 | { | ||
132 | try | ||
133 | { | ||
134 | types = pluginAssembly.GetTypes(); | ||
135 | } | ||
136 | catch (ReflectionTypeLoadException ex) | ||
137 | { | ||
138 | m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + FileName + ": " + | ||
139 | ex.LoaderExceptions[0].Message, ex); | ||
140 | } | ||
141 | catch (Exception ex) | ||
142 | { | ||
143 | m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + FileName, ex); | ||
144 | } | ||
141 | 145 | ||
142 | if (meshTypeInterface != null) | 146 | if (types != null) |
147 | { | ||
148 | foreach (Type pluginType in types) | ||
149 | { | ||
150 | if (pluginType.IsPublic) | ||
143 | { | 151 | { |
144 | IMeshingPlugin plug = | 152 | if (!pluginType.IsAbstract) |
145 | (IMeshingPlugin) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
146 | if (!_MeshPlugins.ContainsKey(plug.GetName())) | ||
147 | { | 153 | { |
148 | _MeshPlugins.Add(plug.GetName(), plug); | 154 | Type physTypeInterface = pluginType.GetInterface("IPhysicsPlugin", true); |
149 | m_log.Info("[PHYSICS]: Added meshing engine: " + plug.GetName()); | 155 | |
156 | if (physTypeInterface != null) | ||
157 | { | ||
158 | IPhysicsPlugin plug = | ||
159 | (IPhysicsPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
160 | plug.Init(); | ||
161 | if (!_PhysPlugins.ContainsKey(plug.GetName())) | ||
162 | { | ||
163 | _PhysPlugins.Add(plug.GetName(), plug); | ||
164 | m_log.Info("[PHYSICS]: Added physics engine: " + plug.GetName()); | ||
165 | } | ||
166 | } | ||
167 | |||
168 | Type meshTypeInterface = pluginType.GetInterface("IMeshingPlugin", true); | ||
169 | |||
170 | if (meshTypeInterface != null) | ||
171 | { | ||
172 | IMeshingPlugin plug = | ||
173 | (IMeshingPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
174 | if (!_MeshPlugins.ContainsKey(plug.GetName())) | ||
175 | { | ||
176 | _MeshPlugins.Add(plug.GetName(), plug); | ||
177 | m_log.Info("[PHYSICS]: Added meshing engine: " + plug.GetName()); | ||
178 | } | ||
179 | } | ||
180 | |||
181 | physTypeInterface = null; | ||
182 | meshTypeInterface = null; | ||
150 | } | 183 | } |
151 | } | 184 | } |
152 | |||
153 | physTypeInterface = null; | ||
154 | meshTypeInterface = null; | ||
155 | } | 185 | } |
156 | } | 186 | } |
157 | } | 187 | } |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index f9d990b..3575a51 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs | |||
@@ -27,10 +27,10 @@ | |||
27 | 27 | ||
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using Axiom.Math; | ||
31 | using log4net; | 30 | using log4net; |
32 | using Nini.Config; | 31 | using Nini.Config; |
33 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenMetaverse; | ||
34 | 34 | ||
35 | namespace OpenSim.Region.Physics.Manager | 35 | namespace OpenSim.Region.Physics.Manager |
36 | { | 36 | { |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsVector.cs b/OpenSim/Region/Physics/Manager/PhysicsVector.cs index adf4715..bbd6464 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsVector.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsVector.cs | |||
@@ -60,7 +60,7 @@ namespace OpenSim.Region.Physics.Manager | |||
60 | } | 60 | } |
61 | 61 | ||
62 | /// <summary> | 62 | /// <summary> |
63 | /// These routines are the easiest way to store XYZ values in an LLVector3 without requiring 3 calls. | 63 | /// These routines are the easiest way to store XYZ values in an Vector3 without requiring 3 calls. |
64 | /// </summary> | 64 | /// </summary> |
65 | /// <returns></returns> | 65 | /// <returns></returns> |
66 | public byte[] GetBytes() | 66 | public byte[] GetBytes() |
diff --git a/OpenSim/Region/Physics/Meshing/Extruder.cs b/OpenSim/Region/Physics/Meshing/Extruder.cs index a47b6ae..1fc65e3 100644 --- a/OpenSim/Region/Physics/Meshing/Extruder.cs +++ b/OpenSim/Region/Physics/Meshing/Extruder.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | //#define SPAM | 27 | //#define SPAM |
28 | 28 | ||
29 | using OpenMetaverse; | ||
29 | using OpenSim.Region.Physics.Manager; | 30 | using OpenSim.Region.Physics.Manager; |
30 | 31 | ||
31 | namespace OpenSim.Region.Physics.Meshing | 32 | namespace OpenSim.Region.Physics.Meshing |
@@ -72,9 +73,6 @@ namespace OpenSim.Region.Physics.Meshing | |||
72 | { | 73 | { |
73 | Mesh result = new Mesh(); | 74 | Mesh result = new Mesh(); |
74 | 75 | ||
75 | // Quaternion tt = new Quaternion(); | ||
76 | // Vertex v2 = new Vertex(0, 0, 0); | ||
77 | |||
78 | Mesh newLayer; | 76 | Mesh newLayer; |
79 | Mesh lastLayer = null; | 77 | Mesh lastLayer = null; |
80 | 78 | ||
@@ -163,7 +161,7 @@ namespace OpenSim.Region.Physics.Meshing | |||
163 | 161 | ||
164 | // apply twist rotation to the profile layer and position the layer in the prim | 162 | // apply twist rotation to the profile layer and position the layer in the prim |
165 | 163 | ||
166 | Quaternion profileRot = new Quaternion(new Vertex(0.0f, 0.0f, 1.0f), twist); | 164 | Quaternion profileRot = Quaternion.CreateFromAxisAngle(new Vector3(0.0f, 0.0f, 1.0f), twist); |
167 | foreach (Vertex v in newLayer.vertices) | 165 | foreach (Vertex v in newLayer.vertices) |
168 | { | 166 | { |
169 | if (v != null) | 167 | if (v != null) |
@@ -259,9 +257,6 @@ namespace OpenSim.Region.Physics.Meshing | |||
259 | { | 257 | { |
260 | Mesh result = new Mesh(); | 258 | Mesh result = new Mesh(); |
261 | 259 | ||
262 | // Quaternion tt = new Quaternion(); | ||
263 | // Vertex v2 = new Vertex(0, 0, 0); | ||
264 | |||
265 | Mesh newLayer; | 260 | Mesh newLayer; |
266 | Mesh lastLayer = null; | 261 | Mesh lastLayer = null; |
267 | 262 | ||
@@ -377,7 +372,7 @@ namespace OpenSim.Region.Physics.Meshing | |||
377 | // next apply twist rotation to the profile layer | 372 | // next apply twist rotation to the profile layer |
378 | if (twistTotal != 0.0f || twistBot != 0.0f) | 373 | if (twistTotal != 0.0f || twistBot != 0.0f) |
379 | { | 374 | { |
380 | Quaternion profileRot = new Quaternion(new Vertex(0.0f, 0.0f, 1.0f), twist); | 375 | Quaternion profileRot = new Quaternion(new Vector3(0.0f, 0.0f, 1.0f), twist); |
381 | foreach (Vertex v in newLayer.vertices) | 376 | foreach (Vertex v in newLayer.vertices) |
382 | { | 377 | { |
383 | if (v != null) | 378 | if (v != null) |
@@ -392,7 +387,7 @@ namespace OpenSim.Region.Physics.Meshing | |||
392 | 387 | ||
393 | // now orient the rotation of the profile layer relative to it's position on the path | 388 | // now orient the rotation of the profile layer relative to it's position on the path |
394 | // adding pushY to the angle used to generate the quat appears to approximate the viewer | 389 | // adding pushY to the angle used to generate the quat appears to approximate the viewer |
395 | Quaternion layerRot = new Quaternion(new Vertex(1.0f, 0.0f, 0.0f), (float)angle + pushY * 0.9f); | 390 | Quaternion layerRot = Quaternion.CreateFromAxisAngle(new Vector3(1.0f, 0.0f, 0.0f), (float)angle + pushY * 0.9f); |
396 | foreach (Vertex v in newLayer.vertices) | 391 | foreach (Vertex v in newLayer.vertices) |
397 | { | 392 | { |
398 | if (v != null) | 393 | if (v != null) |
diff --git a/OpenSim/Region/Physics/Meshing/HelperTypes.cs b/OpenSim/Region/Physics/Meshing/HelperTypes.cs index 2cb8d04..7491782 100644 --- a/OpenSim/Region/Physics/Meshing/HelperTypes.cs +++ b/OpenSim/Region/Physics/Meshing/HelperTypes.cs | |||
@@ -29,70 +29,10 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Diagnostics; | 30 | using System.Diagnostics; |
31 | using System.Globalization; | 31 | using System.Globalization; |
32 | using OpenMetaverse; | ||
32 | using OpenSim.Region.Physics.Manager; | 33 | using OpenSim.Region.Physics.Manager; |
33 | using OpenSim.Region.Physics.Meshing; | 34 | using OpenSim.Region.Physics.Meshing; |
34 | 35 | ||
35 | public class Quaternion | ||
36 | { | ||
37 | public float x = 0; | ||
38 | public float y = 0; | ||
39 | public float z = 0; | ||
40 | public float w = 1; | ||
41 | |||
42 | public Quaternion() | ||
43 | { | ||
44 | |||
45 | } | ||
46 | public Quaternion(float x1, float y1, float z1, float w1) | ||
47 | { | ||
48 | x = x1; y = y1; z = z1; w = w1; | ||
49 | } | ||
50 | public Quaternion(Vertex axis, float angle) | ||
51 | { | ||
52 | // using (* 0.5) instead of (/2) | ||
53 | w = (float)Math.Cos(angle * 0.5f); | ||
54 | float sin = (float)Math.Sin(angle * 0.5f); | ||
55 | //x = axis.X * (float)Math.Sin(angle * 0.5f); | ||
56 | //y = axis.Y * (float)Math.Sin(angle * 0.5f); | ||
57 | //z = axis.Z * (float)Math.Sin(angle * 0.5f); | ||
58 | x = axis.X * sin; | ||
59 | y = axis.Y * sin; | ||
60 | z = axis.Z * sin; | ||
61 | normalize(); | ||
62 | } | ||
63 | public static Quaternion operator *(Quaternion a, Quaternion b) | ||
64 | { | ||
65 | Quaternion c = new Quaternion(); | ||
66 | c.x = a.w * b.x + a.x * b.w + a.y * b.z - a.z * b.y; | ||
67 | c.y = a.w * b.y + a.y * b.w + a.z * b.x - a.x * b.z; | ||
68 | c.z = a.w * b.z + a.z * b.w + a.x * b.y - a.y * b.x; | ||
69 | c.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z; | ||
70 | return c; | ||
71 | } | ||
72 | |||
73 | public void normalize() | ||
74 | { | ||
75 | //float mag = length(); | ||
76 | |||
77 | //w /= mag; | ||
78 | //x /= mag; | ||
79 | //y /= mag; | ||
80 | //z /= mag; | ||
81 | float iMag = 1.0f / length(); | ||
82 | |||
83 | w *= iMag; | ||
84 | x *= iMag; | ||
85 | y *= iMag; | ||
86 | z *= iMag; | ||
87 | } | ||
88 | public float length() | ||
89 | { | ||
90 | return (float)Math.Sqrt(w * w + x * x + y * y + z * z); | ||
91 | } | ||
92 | } | ||
93 | |||
94 | |||
95 | |||
96 | public class Vertex : PhysicsVector, IComparable<Vertex> | 36 | public class Vertex : PhysicsVector, IComparable<Vertex> |
97 | { | 37 | { |
98 | public Vertex(float x, float y, float z) | 38 | public Vertex(float x, float y, float z) |
@@ -129,34 +69,34 @@ public class Vertex : PhysicsVector, IComparable<Vertex> | |||
129 | 69 | ||
130 | Vertex v2 = new Vertex(0f, 0f, 0f); | 70 | Vertex v2 = new Vertex(0f, 0f, 0f); |
131 | 71 | ||
132 | v2.X = q.w * q.w * v.X + | 72 | v2.X = q.W * q.W * v.X + |
133 | 2f * q.y * q.w * v.Z - | 73 | 2f * q.Y * q.W * v.Z - |
134 | 2f * q.z * q.w * v.Y + | 74 | 2f * q.Z * q.W * v.Y + |
135 | q.x * q.x * v.X + | 75 | q.X * q.X * v.X + |
136 | 2f * q.y * q.x * v.Y + | 76 | 2f * q.Y * q.X * v.Y + |
137 | 2f * q.z * q.x * v.Z - | 77 | 2f * q.Z * q.X * v.Z - |
138 | q.z * q.z * v.X - | 78 | q.Z * q.Z * v.X - |
139 | q.y * q.y * v.X; | 79 | q.Y * q.Y * v.X; |
140 | 80 | ||
141 | v2.Y = | 81 | v2.Y = |
142 | 2f * q.x * q.y * v.X + | 82 | 2f * q.X * q.Y * v.X + |
143 | q.y * q.y * v.Y + | 83 | q.Y * q.Y * v.Y + |
144 | 2f * q.z * q.y * v.Z + | 84 | 2f * q.Z * q.Y * v.Z + |
145 | 2f * q.w * q.z * v.X - | 85 | 2f * q.W * q.Z * v.X - |
146 | q.z * q.z * v.Y + | 86 | q.Z * q.Z * v.Y + |
147 | q.w * q.w * v.Y - | 87 | q.W * q.W * v.Y - |
148 | 2f * q.x * q.w * v.Z - | 88 | 2f * q.X * q.W * v.Z - |
149 | q.x * q.x * v.Y; | 89 | q.X * q.X * v.Y; |
150 | 90 | ||
151 | v2.Z = | 91 | v2.Z = |
152 | 2f * q.x * q.z * v.X + | 92 | 2f * q.X * q.Z * v.X + |
153 | 2f * q.y * q.z * v.Y + | 93 | 2f * q.Y * q.Z * v.Y + |
154 | q.z * q.z * v.Z - | 94 | q.Z * q.Z * v.Z - |
155 | 2f * q.w * q.y * v.X - | 95 | 2f * q.W * q.Y * v.X - |
156 | q.y * q.y * v.Z + | 96 | q.Y * q.Y * v.Z + |
157 | 2f * q.w * q.x * v.Y - | 97 | 2f * q.W * q.X * v.Y - |
158 | q.x * q.x * v.Z + | 98 | q.X * q.X * v.Z + |
159 | q.w * q.w * v.Z; | 99 | q.W * q.W * v.Z; |
160 | 100 | ||
161 | return v2; | 101 | return v2; |
162 | } | 102 | } |
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index ecde92a..f955c52 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs | |||
@@ -30,6 +30,7 @@ using System; | |||
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
32 | using OpenSim.Region.Physics.Manager; | 32 | using OpenSim.Region.Physics.Manager; |
33 | using OpenMetaverse; | ||
33 | 34 | ||
34 | namespace OpenSim.Region.Physics.Meshing | 35 | namespace OpenSim.Region.Physics.Meshing |
35 | { | 36 | { |
@@ -1559,7 +1560,7 @@ namespace OpenSim.Region.Physics.Meshing | |||
1559 | 1560 | ||
1560 | if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.Circle) | 1561 | if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.Circle) |
1561 | { | 1562 | { |
1562 | Quaternion zFlip = new Quaternion(new Vertex(0.0f, 0.0f, 1.0f), (float)Math.PI); | 1563 | Quaternion zFlip = Quaternion.CreateFromAxisAngle(new Vector3(0.0f, 0.0f, 1.0f), (float)Math.PI); |
1563 | Vertex vTmp = new Vertex(0.0f, 0.0f, 0.0f); | 1564 | Vertex vTmp = new Vertex(0.0f, 0.0f, 0.0f); |
1564 | foreach (Vertex v in cuttedHull.getVertices()) | 1565 | foreach (Vertex v in cuttedHull.getVertices()) |
1565 | if (v != null) | 1566 | if (v != null) |
diff --git a/OpenSim/Region/Physics/Meshing/PrimMesher.cs b/OpenSim/Region/Physics/Meshing/PrimMesher.cs index 86bdabc..08b2d10 100644 --- a/OpenSim/Region/Physics/Meshing/PrimMesher.cs +++ b/OpenSim/Region/Physics/Meshing/PrimMesher.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.IO; | 30 | using System.IO; |
31 | using OpenSim.Region.Physics.Manager; | 31 | using OpenSim.Region.Physics.Manager; |
32 | using OpenMetaverse; | ||
32 | 33 | ||
33 | namespace OpenSim.Region.Physics.Meshing | 34 | namespace OpenSim.Region.Physics.Meshing |
34 | { | 35 | { |
@@ -783,7 +784,7 @@ angles24 = [ | |||
783 | Profile profile = new Profile(this.sides, this.profileStart, this.profileEnd, hollow, this.hollowSides); | 784 | Profile profile = new Profile(this.sides, this.profileStart, this.profileEnd, hollow, this.hollowSides); |
784 | 785 | ||
785 | if (initialProfileRot != 0.0f) | 786 | if (initialProfileRot != 0.0f) |
786 | profile.AddRot(new Quaternion(new Vertex(0.0f, 0.0f, 1.0f), initialProfileRot)); | 787 | profile.AddRot(Quaternion.CreateFromAxisAngle(new Vector3(0.0f, 0.0f, 1.0f), initialProfileRot)); |
787 | 788 | ||
788 | bool done = false; | 789 | bool done = false; |
789 | while (!done) | 790 | while (!done) |
@@ -807,7 +808,7 @@ angles24 = [ | |||
807 | 808 | ||
808 | float twist = twistBegin + twistTotal * percentOfPath; | 809 | float twist = twistBegin + twistTotal * percentOfPath; |
809 | if (twist != 0.0f) | 810 | if (twist != 0.0f) |
810 | newLayer.AddRot(new Quaternion(new Vertex(0.0f, 0.0f, 1.0f), twist)); | 811 | newLayer.AddRot(Quaternion.CreateFromAxisAngle(new Vector3(0.0f, 0.0f, 1.0f), twist)); |
811 | 812 | ||
812 | newLayer.AddPos(xOffset, yOffset, zOffset); | 813 | newLayer.AddPos(xOffset, yOffset, zOffset); |
813 | 814 | ||
@@ -948,7 +949,7 @@ angles24 = [ | |||
948 | Profile profile = new Profile(this.sides, this.profileStart, this.profileEnd, hollow, this.hollowSides); | 949 | Profile profile = new Profile(this.sides, this.profileStart, this.profileEnd, hollow, this.hollowSides); |
949 | 950 | ||
950 | if (initialProfileRot != 0.0f) | 951 | if (initialProfileRot != 0.0f) |
951 | profile.AddRot(new Quaternion(new Vertex(0.0f, 0.0f, 1.0f), initialProfileRot)); | 952 | profile.AddRot(Quaternion.CreateFromAxisAngle(new Vector3(0.0f, 0.0f, 1.0f), initialProfileRot)); |
952 | 953 | ||
953 | bool done = false; | 954 | bool done = false; |
954 | while (!done) // loop through the length of the path and add the layers | 955 | while (!done) // loop through the length of the path and add the layers |
@@ -991,12 +992,12 @@ angles24 = [ | |||
991 | 992 | ||
992 | // next apply twist rotation to the profile layer | 993 | // next apply twist rotation to the profile layer |
993 | if (twistTotal != 0.0f || twistBegin != 0.0f) | 994 | if (twistTotal != 0.0f || twistBegin != 0.0f) |
994 | newLayer.AddRot(new Quaternion(new Vertex(0.0f, 0.0f, 1.0f), twist)); | 995 | newLayer.AddRot(Quaternion.CreateFromAxisAngle(new Vector3(0.0f, 0.0f, 1.0f), twist)); |
995 | 996 | ||
996 | // now orient the rotation of the profile layer relative to it's position on the path | 997 | // now orient the rotation of the profile layer relative to it's position on the path |
997 | // adding taperY to the angle used to generate the quat appears to approximate the viewer | 998 | // adding taperY to the angle used to generate the quat appears to approximate the viewer |
998 | //newLayer.AddRot(new Quaternion(new Vertex(1.0f, 0.0f, 0.0f), angle + this.topShearY * 0.9f)); | 999 | //newLayer.AddRot(new Quaternion(new Vertex(1.0f, 0.0f, 0.0f), angle + this.topShearY * 0.9f)); |
999 | newLayer.AddRot(new Quaternion(new Vertex(1.0f, 0.0f, 0.0f), angle + this.topShearY)); | 1000 | newLayer.AddRot(Quaternion.CreateFromAxisAngle(new Vector3(1.0f, 0.0f, 0.0f), angle + this.topShearY)); |
1000 | newLayer.AddPos(xOffset, yOffset, zOffset); | 1001 | newLayer.AddPos(xOffset, yOffset, zOffset); |
1001 | 1002 | ||
1002 | if (angle == startAngle) | 1003 | if (angle == startAngle) |
diff --git a/OpenSim/Region/Physics/Meshing/SculptMesh.cs b/OpenSim/Region/Physics/Meshing/SculptMesh.cs index 360b2f7..707c0e3 100644 --- a/OpenSim/Region/Physics/Meshing/SculptMesh.cs +++ b/OpenSim/Region/Physics/Meshing/SculptMesh.cs | |||
@@ -30,14 +30,14 @@ using System.Collections.Generic; | |||
30 | using System.Drawing; | 30 | using System.Drawing; |
31 | using System.Drawing.Imaging; | 31 | using System.Drawing.Imaging; |
32 | using System.Text; | 32 | using System.Text; |
33 | using OpenJPEGNet; | 33 | using OpenMetaverse.Imaging; |
34 | using Image = System.Drawing.Image; | ||
35 | 34 | ||
36 | namespace OpenSim.Region.Physics.Meshing | 35 | namespace OpenSim.Region.Physics.Meshing |
37 | { | 36 | { |
38 | // This functionality based on the XNA SculptPreview by John Hurliman. | 37 | // This functionality based on the XNA SculptPreview by John Hurliman. |
39 | public class SculptMesh : Mesh | 38 | public class SculptMesh : Mesh |
40 | { | 39 | { |
40 | ManagedImage managedImage; | ||
41 | Image idata = null; | 41 | Image idata = null; |
42 | Bitmap bLOD = null; | 42 | Bitmap bLOD = null; |
43 | Bitmap bBitmap = null; | 43 | Bitmap bBitmap = null; |
@@ -55,7 +55,7 @@ namespace OpenSim.Region.Physics.Meshing | |||
55 | 55 | ||
56 | try | 56 | try |
57 | { | 57 | { |
58 | idata = OpenJPEG.DecodeToImage(jpegData); | 58 | OpenJPEG.DecodeToImage(jpegData, out managedImage, out idata); |
59 | //int i = 0; | 59 | //int i = 0; |
60 | //i = i / i; | 60 | //i = i / i; |
61 | } | 61 | } |
@@ -64,6 +64,7 @@ namespace OpenSim.Region.Physics.Meshing | |||
64 | System.Console.WriteLine("[PHYSICS]: Unable to generate a Sculpty physics proxy. Sculpty texture decode failed!"); | 64 | System.Console.WriteLine("[PHYSICS]: Unable to generate a Sculpty physics proxy. Sculpty texture decode failed!"); |
65 | return; | 65 | return; |
66 | } | 66 | } |
67 | |||
67 | if (idata != null) | 68 | if (idata != null) |
68 | { | 69 | { |
69 | bBitmap = new Bitmap(idata); | 70 | bBitmap = new Bitmap(idata); |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 5d3e986..38d4060 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | |||
@@ -26,7 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using Axiom.Math; | 29 | using OpenMetaverse; |
30 | using Ode.NET; | 30 | using Ode.NET; |
31 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
32 | using OpenSim.Region.Physics.Manager; | 32 | using OpenSim.Region.Physics.Manager; |
@@ -587,7 +587,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
587 | //Matrix3 or = Orientation.ToRotationMatrix(); | 587 | //Matrix3 or = Orientation.ToRotationMatrix(); |
588 | //d.Matrix3 ord = new d.Matrix3(or.m00, or.m10, or.m20, or.m01, or.m11, or.m21, or.m02, or.m12, or.m22); | 588 | //d.Matrix3 ord = new d.Matrix3(or.m00, or.m10, or.m20, or.m01, or.m11, or.m21, or.m02, or.m12, or.m22); |
589 | //d.BodySetRotation(Body, ref ord); | 589 | //d.BodySetRotation(Body, ref ord); |
590 | |||
591 | } | 590 | } |
592 | } | 591 | } |
593 | 592 | ||
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index eafce5a..21e514b 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -30,8 +30,8 @@ using System.Collections.Generic; | |||
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Runtime.InteropServices; | 31 | using System.Runtime.InteropServices; |
32 | using System.Threading; | 32 | using System.Threading; |
33 | using Axiom.Math; | ||
34 | using log4net; | 33 | using log4net; |
34 | using OpenMetaverse; | ||
35 | using Ode.NET; | 35 | using Ode.NET; |
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Region.Physics.Manager; | 37 | using OpenSim.Region.Physics.Manager; |
@@ -294,10 +294,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
294 | setMass(); | 294 | setMass(); |
295 | d.BodySetPosition(Body, _position.X, _position.Y, _position.Z); | 295 | d.BodySetPosition(Body, _position.X, _position.Y, _position.Z); |
296 | d.Quaternion myrot = new d.Quaternion(); | 296 | d.Quaternion myrot = new d.Quaternion(); |
297 | myrot.W = _orientation.w; | 297 | myrot.X = _orientation.X; |
298 | myrot.X = _orientation.x; | 298 | myrot.Y = _orientation.Y; |
299 | myrot.Y = _orientation.y; | 299 | myrot.Z = _orientation.Z; |
300 | myrot.Z = _orientation.z; | 300 | myrot.W = _orientation.W; |
301 | d.BodySetQuaternion(Body, ref myrot); | 301 | d.BodySetQuaternion(Body, ref myrot); |
302 | d.GeomSetBody(prim_geom, Body); | 302 | d.GeomSetBody(prim_geom, Body); |
303 | m_collisionCategories |= CollisionCategories.Body; | 303 | m_collisionCategories |= CollisionCategories.Body; |
@@ -1021,10 +1021,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1021 | { | 1021 | { |
1022 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); | 1022 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); |
1023 | d.Quaternion myrot = new d.Quaternion(); | 1023 | d.Quaternion myrot = new d.Quaternion(); |
1024 | myrot.W = _orientation.w; | 1024 | myrot.X = _orientation.X; |
1025 | myrot.X = _orientation.x; | 1025 | myrot.Y = _orientation.Y; |
1026 | myrot.Y = _orientation.y; | 1026 | myrot.Z = _orientation.Z; |
1027 | myrot.Z = _orientation.z; | 1027 | myrot.W = _orientation.W; |
1028 | d.GeomSetQuaternion(prim_geom, ref myrot); | 1028 | d.GeomSetQuaternion(prim_geom, ref myrot); |
1029 | } | 1029 | } |
1030 | 1030 | ||
@@ -1220,10 +1220,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1220 | public void rotate(float timestep) | 1220 | public void rotate(float timestep) |
1221 | { | 1221 | { |
1222 | d.Quaternion myrot = new d.Quaternion(); | 1222 | d.Quaternion myrot = new d.Quaternion(); |
1223 | myrot.W = _orientation.w; | 1223 | myrot.X = _orientation.X; |
1224 | myrot.X = _orientation.x; | 1224 | myrot.Y = _orientation.Y; |
1225 | myrot.Y = _orientation.y; | 1225 | myrot.Z = _orientation.Z; |
1226 | myrot.Z = _orientation.z; | 1226 | myrot.W = _orientation.W; |
1227 | d.GeomSetQuaternion(prim_geom, ref myrot); | 1227 | d.GeomSetQuaternion(prim_geom, ref myrot); |
1228 | if (m_isphysical && Body != (IntPtr) 0) | 1228 | if (m_isphysical && Body != (IntPtr) 0) |
1229 | { | 1229 | { |
@@ -1339,10 +1339,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1339 | setMesh(_parent_scene, mesh); | 1339 | setMesh(_parent_scene, mesh); |
1340 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); | 1340 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); |
1341 | d.Quaternion myrot = new d.Quaternion(); | 1341 | d.Quaternion myrot = new d.Quaternion(); |
1342 | myrot.W = _orientation.w; | 1342 | myrot.X = _orientation.X; |
1343 | myrot.X = _orientation.x; | 1343 | myrot.Y = _orientation.Y; |
1344 | myrot.Y = _orientation.y; | 1344 | myrot.Z = _orientation.Z; |
1345 | myrot.Z = _orientation.z; | 1345 | myrot.W = _orientation.W; |
1346 | d.GeomSetQuaternion(prim_geom, ref myrot); | 1346 | d.GeomSetQuaternion(prim_geom, ref myrot); |
1347 | 1347 | ||
1348 | //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z); | 1348 | //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z); |
@@ -1388,10 +1388,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1388 | //prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); | 1388 | //prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); |
1389 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); | 1389 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); |
1390 | d.Quaternion myrot = new d.Quaternion(); | 1390 | d.Quaternion myrot = new d.Quaternion(); |
1391 | myrot.W = _orientation.w; | 1391 | myrot.X = _orientation.X; |
1392 | myrot.X = _orientation.x; | 1392 | myrot.Y = _orientation.Y; |
1393 | myrot.Y = _orientation.y; | 1393 | myrot.Z = _orientation.Z; |
1394 | myrot.Z = _orientation.z; | 1394 | myrot.W = _orientation.W; |
1395 | d.GeomSetQuaternion(prim_geom, ref myrot); | 1395 | d.GeomSetQuaternion(prim_geom, ref myrot); |
1396 | } | 1396 | } |
1397 | } | 1397 | } |
@@ -1452,9 +1452,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1452 | // d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); | 1452 | // d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); |
1453 | // d.Quaternion myrot = new d.Quaternion(); | 1453 | // d.Quaternion myrot = new d.Quaternion(); |
1454 | // myrot.W = _orientation.w; | 1454 | // myrot.W = _orientation.w; |
1455 | // myrot.X = _orientation.x; | 1455 | // myrot.X = _orientation.X; |
1456 | // myrot.Y = _orientation.y; | 1456 | // myrot.Y = _orientation.Y; |
1457 | // myrot.Z = _orientation.z; | 1457 | // myrot.Z = _orientation.Z; |
1458 | // d.GeomSetQuaternion(prim_geom, ref myrot); | 1458 | // d.GeomSetQuaternion(prim_geom, ref myrot); |
1459 | 1459 | ||
1460 | // //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z); | 1460 | // //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z); |
@@ -1512,9 +1512,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1512 | // d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); | 1512 | // d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); |
1513 | // d.Quaternion myrot = new d.Quaternion(); | 1513 | // d.Quaternion myrot = new d.Quaternion(); |
1514 | // myrot.W = _orientation.w; | 1514 | // myrot.W = _orientation.w; |
1515 | // myrot.X = _orientation.x; | 1515 | // myrot.X = _orientation.X; |
1516 | // myrot.Y = _orientation.y; | 1516 | // myrot.Y = _orientation.Y; |
1517 | // myrot.Z = _orientation.z; | 1517 | // myrot.Z = _orientation.Z; |
1518 | // d.GeomSetQuaternion(prim_geom, ref myrot); | 1518 | // d.GeomSetQuaternion(prim_geom, ref myrot); |
1519 | // } | 1519 | // } |
1520 | // } | 1520 | // } |
@@ -1553,9 +1553,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1553 | // d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); | 1553 | // d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); |
1554 | // d.Quaternion myrot = new d.Quaternion(); | 1554 | // d.Quaternion myrot = new d.Quaternion(); |
1555 | // myrot.W = _orientation.w; | 1555 | // myrot.W = _orientation.w; |
1556 | // myrot.X = _orientation.x; | 1556 | // myrot.X = _orientation.X; |
1557 | // myrot.Y = _orientation.y; | 1557 | // myrot.Y = _orientation.Y; |
1558 | // myrot.Z = _orientation.z; | 1558 | // myrot.Z = _orientation.Z; |
1559 | // d.GeomSetQuaternion(prim_geom, ref myrot); | 1559 | // d.GeomSetQuaternion(prim_geom, ref myrot); |
1560 | 1560 | ||
1561 | // //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z); | 1561 | // //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z); |
@@ -1626,10 +1626,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1626 | setMesh(_parent_scene, mesh); | 1626 | setMesh(_parent_scene, mesh); |
1627 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); | 1627 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); |
1628 | d.Quaternion myrot = new d.Quaternion(); | 1628 | d.Quaternion myrot = new d.Quaternion(); |
1629 | myrot.W = _orientation.w; | 1629 | myrot.X = _orientation.X; |
1630 | myrot.X = _orientation.x; | 1630 | myrot.Y = _orientation.Y; |
1631 | myrot.Y = _orientation.y; | 1631 | myrot.Z = _orientation.Z; |
1632 | myrot.Z = _orientation.z; | 1632 | myrot.W = _orientation.W; |
1633 | d.GeomSetQuaternion(prim_geom, ref myrot); | 1633 | d.GeomSetQuaternion(prim_geom, ref myrot); |
1634 | 1634 | ||
1635 | //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z); | 1635 | //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z); |
@@ -1684,10 +1684,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1684 | //prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); | 1684 | //prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); |
1685 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); | 1685 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); |
1686 | d.Quaternion myrot = new d.Quaternion(); | 1686 | d.Quaternion myrot = new d.Quaternion(); |
1687 | myrot.W = _orientation.w; | 1687 | myrot.X = _orientation.X; |
1688 | myrot.X = _orientation.x; | 1688 | myrot.Y = _orientation.Y; |
1689 | myrot.Y = _orientation.y; | 1689 | myrot.Z = _orientation.Z; |
1690 | myrot.Z = _orientation.z; | 1690 | myrot.W = _orientation.W; |
1691 | d.GeomSetQuaternion(prim_geom, ref myrot); | 1691 | d.GeomSetQuaternion(prim_geom, ref myrot); |
1692 | } | 1692 | } |
1693 | } | 1693 | } |
@@ -1726,9 +1726,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1726 | // d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); | 1726 | // d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); |
1727 | // d.Quaternion myrot = new d.Quaternion(); | 1727 | // d.Quaternion myrot = new d.Quaternion(); |
1728 | // myrot.W = _orientation.w; | 1728 | // myrot.W = _orientation.w; |
1729 | // myrot.X = _orientation.x; | 1729 | // myrot.X = _orientation.X; |
1730 | // myrot.Y = _orientation.y; | 1730 | // myrot.Y = _orientation.Y; |
1731 | // myrot.Z = _orientation.z; | 1731 | // myrot.Z = _orientation.Z; |
1732 | // d.GeomSetQuaternion(prim_geom, ref myrot); | 1732 | // d.GeomSetQuaternion(prim_geom, ref myrot); |
1733 | 1733 | ||
1734 | // //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z); | 1734 | // //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z); |
@@ -2106,9 +2106,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2106 | _acceleration.Z = 0; | 2106 | _acceleration.Z = 0; |
2107 | 2107 | ||
2108 | //_orientation.w = 0f; | 2108 | //_orientation.w = 0f; |
2109 | //_orientation.x = 0f; | 2109 | //_orientation.X = 0f; |
2110 | //_orientation.y = 0f; | 2110 | //_orientation.Y = 0f; |
2111 | //_orientation.z = 0f; | 2111 | //_orientation.Z = 0f; |
2112 | m_rotationalVelocity.X = 0; | 2112 | m_rotationalVelocity.X = 0; |
2113 | m_rotationalVelocity.Y = 0; | 2113 | m_rotationalVelocity.Y = 0; |
2114 | m_rotationalVelocity.Z = 0; | 2114 | m_rotationalVelocity.Z = 0; |
@@ -2154,10 +2154,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2154 | } | 2154 | } |
2155 | 2155 | ||
2156 | //System.Console.WriteLine("ODE: " + m_rotationalVelocity.ToString()); | 2156 | //System.Console.WriteLine("ODE: " + m_rotationalVelocity.ToString()); |
2157 | _orientation.w = ori.W; | 2157 | _orientation.X = ori.X; |
2158 | _orientation.x = ori.X; | 2158 | _orientation.Y = ori.Y; |
2159 | _orientation.y = ori.Y; | 2159 | _orientation.Z = ori.Z; |
2160 | _orientation.z = ori.Z; | 2160 | _orientation.W = ori.W; |
2161 | m_lastUpdateSent = false; | 2161 | m_lastUpdateSent = false; |
2162 | if (!m_throttleUpdates || throttleCounter > _parent_scene.geomUpdatesPerThrottledUpdate) | 2162 | if (!m_throttleUpdates || throttleCounter > _parent_scene.geomUpdatesPerThrottledUpdate) |
2163 | { | 2163 | { |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODETestClass.cs b/OpenSim/Region/Physics/OdePlugin/ODETestClass.cs index 074170a..606134a 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODETestClass.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODETestClass.cs | |||
@@ -26,9 +26,9 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using Axiom.Math; | ||
30 | using Nini.Config; | 29 | using Nini.Config; |
31 | using NUnit.Framework; | 30 | using NUnit.Framework; |
31 | using OpenMetaverse; | ||
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Region.Physics.Manager; | 33 | using OpenSim.Region.Physics.Manager; |
34 | 34 | ||
@@ -74,7 +74,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
74 | PrimitiveBaseShape newcube = PrimitiveBaseShape.CreateBox(); | 74 | PrimitiveBaseShape newcube = PrimitiveBaseShape.CreateBox(); |
75 | PhysicsVector position = new PhysicsVector(128, 128, 128); | 75 | PhysicsVector position = new PhysicsVector(128, 128, 128); |
76 | PhysicsVector size = new PhysicsVector(0.5f, 0.5f, 0.5f); | 76 | PhysicsVector size = new PhysicsVector(0.5f, 0.5f, 0.5f); |
77 | Quaternion rot = new Quaternion(1, 0, 0, 0); | 77 | Quaternion rot = Quaternion.Identity; |
78 | PhysicsActor prim = ps.AddPrimShape("CoolShape", newcube, position, size, rot, true); | 78 | PhysicsActor prim = ps.AddPrimShape("CoolShape", newcube, position, size, rot, true); |
79 | OdePrim oprim = (OdePrim)prim; | 79 | OdePrim oprim = (OdePrim)prim; |
80 | OdeScene pscene = (OdeScene) ps; | 80 | OdeScene pscene = (OdeScene) ps; |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index f285911..5a501ef 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -31,13 +31,12 @@ using System.Reflection; | |||
31 | using System.Runtime.InteropServices; | 31 | using System.Runtime.InteropServices; |
32 | using System.Threading; | 32 | using System.Threading; |
33 | using System.IO; | 33 | using System.IO; |
34 | using Axiom.Math; | ||
35 | using log4net; | 34 | using log4net; |
36 | using Nini.Config; | 35 | using Nini.Config; |
37 | using Ode.NET; | 36 | using Ode.NET; |
38 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
39 | using OpenSim.Region.Physics.Manager; | 38 | using OpenSim.Region.Physics.Manager; |
40 | using libsecondlife; | 39 | using OpenMetaverse; |
41 | 40 | ||
42 | //using OpenSim.Region.Physics.OdePlugin.Meshing; | 41 | //using OpenSim.Region.Physics.OdePlugin.Meshing; |
43 | 42 | ||
@@ -1129,11 +1128,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1129 | siz.X = size.X; | 1128 | siz.X = size.X; |
1130 | siz.Y = size.Y; | 1129 | siz.Y = size.Y; |
1131 | siz.Z = size.Z; | 1130 | siz.Z = size.Z; |
1132 | Quaternion rot = new Quaternion(); | 1131 | Quaternion rot = rotation; |
1133 | rot.w = rotation.w; | ||
1134 | rot.x = rotation.x; | ||
1135 | rot.y = rotation.y; | ||
1136 | rot.z = rotation.z; | ||
1137 | 1132 | ||
1138 | OdePrim newPrim; | 1133 | OdePrim newPrim; |
1139 | lock (OdeLock) | 1134 | lock (OdeLock) |
@@ -1524,8 +1519,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1524 | // but we still need to check for sculptie meshing being enabled so this is the most | 1519 | // but we still need to check for sculptie meshing being enabled so this is the most |
1525 | // convenient place to do it for now... | 1520 | // convenient place to do it for now... |
1526 | 1521 | ||
1527 | // //if (pbs.PathCurve == (byte)LLObject.PathCurve.Circle && pbs.ProfileCurve == (byte)LLObject.ProfileCurve.Circle && pbs.PathScaleY <= 0.75f) | 1522 | // //if (pbs.PathCurve == (byte)Primitive.PathCurve.Circle && pbs.ProfileCurve == (byte)Primitive.ProfileCurve.Circle && pbs.PathScaleY <= 0.75f) |
1528 | // //Console.WriteLine("needsMeshing: " + " pathCurve: " + pbs.PathCurve.ToString() + " profileCurve: " + pbs.ProfileCurve.ToString() + " pathScaleY: " + LLObject.UnpackPathScale(pbs.PathScaleY).ToString()); | 1523 | // //Console.WriteLine("needsMeshing: " + " pathCurve: " + pbs.PathCurve.ToString() + " profileCurve: " + pbs.ProfileCurve.ToString() + " pathScaleY: " + Primitive.UnpackPathScale(pbs.PathScaleY).ToString()); |
1529 | if (pbs.SculptEntry && !meshSculptedPrim) | 1524 | if (pbs.SculptEntry && !meshSculptedPrim) |
1530 | { | 1525 | { |
1531 | return false; | 1526 | return false; |
@@ -1555,19 +1550,19 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1555 | // return true; | 1550 | // return true; |
1556 | 1551 | ||
1557 | // // test for torus | 1552 | // // test for torus |
1558 | // if (pbs.PathCurve == (byte)LLObject.PathCurve.Circle | 1553 | // if (pbs.PathCurve == (byte)Primitive.PathCurve.Circle |
1559 | // && (pbs.ProfileCurve & 0x07) == (byte)LLObject.ProfileCurve.Circle | 1554 | // && (pbs.ProfileCurve & 0x07) == (byte)Primitive.ProfileCurve.Circle |
1560 | // && LLObject.UnpackPathScale(pbs.PathScaleY) <= 0.75f) | 1555 | // && Primitive.UnpackPathScale(pbs.PathScaleY) <= 0.75f) |
1561 | // return true; | 1556 | // return true; |
1562 | 1557 | ||
1563 | // // test for tube | 1558 | // // test for tube |
1564 | // if (pbs.PathCurve == (byte)LLObject.PathCurve.Circle | 1559 | // if (pbs.PathCurve == (byte)Primitive.PathCurve.Circle |
1565 | // && (pbs.ProfileCurve & 0x07) == (byte)LLObject.ProfileCurve.EqualTriangle) | 1560 | // && (pbs.ProfileCurve & 0x07) == (byte)Primitive.ProfileCurve.EqualTriangle) |
1566 | // return true; | 1561 | // return true; |
1567 | 1562 | ||
1568 | // // test for ring | 1563 | // // test for ring |
1569 | // if (pbs.PathCurve == (byte)LLObject.PathCurve.Circle | 1564 | // if (pbs.PathCurve == (byte)Primitive.PathCurve.Circle |
1570 | // && (pbs.ProfileCurve & 0x07) == (byte)LLObject.ProfileCurve.EqualTriangle) | 1565 | // && (pbs.ProfileCurve & 0x07) == (byte)Primitive.ProfileCurve.EqualTriangle) |
1571 | // return true; | 1566 | // return true; |
1572 | 1567 | ||
1573 | // if (pbs.ProfileShape == ProfileShape.EquilateralTriangle) | 1568 | // if (pbs.ProfileShape == ProfileShape.EquilateralTriangle) |
@@ -2132,17 +2127,17 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2132 | 2127 | ||
2133 | d.Matrix3 R = new d.Matrix3(); | 2128 | d.Matrix3 R = new d.Matrix3(); |
2134 | 2129 | ||
2135 | Quaternion q1 = Quaternion.FromAngleAxis(1.5707f, new Vector3(1, 0, 0)); | 2130 | Quaternion q1 = Quaternion.CreateFromAxisAngle(new Vector3(1, 0, 0), 1.5707f); |
2136 | Quaternion q2 = Quaternion.FromAngleAxis(1.5707f, new Vector3(0, 1, 0)); | 2131 | Quaternion q2 = Quaternion.CreateFromAxisAngle(new Vector3(0, 1, 0), 1.5707f); |
2137 | //Axiom.Math.Quaternion q3 = Axiom.Math.Quaternion.FromAngleAxis(3.14f, new Axiom.Math.Vector3(0, 0, 1)); | 2132 | //Axiom.Math.Quaternion q3 = Axiom.Math.Quaternion.FromAngleAxis(3.14f, new Axiom.Math.Vector3(0, 0, 1)); |
2138 | 2133 | ||
2139 | q1 = q1*q2; | 2134 | q1 = q1*q2; |
2140 | //q1 = q1 * q3; | 2135 | //q1 = q1 * q3; |
2141 | Vector3 v3 = new Vector3(); | 2136 | Vector3 v3; |
2142 | float angle = 0; | 2137 | float angle; |
2143 | q1.ToAngleAxis(ref angle, ref v3); | 2138 | q1.GetAxisAngle(out v3, out angle); |
2144 | 2139 | ||
2145 | d.RFromAxisAndAngle(out R, v3.x, v3.y, v3.z, angle); | 2140 | d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle); |
2146 | d.GeomSetRotation(LandGeom, ref R); | 2141 | d.GeomSetRotation(LandGeom, ref R); |
2147 | d.GeomSetPosition(LandGeom, 128, 128, 0); | 2142 | d.GeomSetPosition(LandGeom, 128, 128, 0); |
2148 | } | 2143 | } |
@@ -2197,17 +2192,17 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2197 | 2192 | ||
2198 | d.Matrix3 R = new d.Matrix3(); | 2193 | d.Matrix3 R = new d.Matrix3(); |
2199 | 2194 | ||
2200 | Quaternion q1 = Quaternion.FromAngleAxis(1.5707f, new Vector3(1, 0, 0)); | 2195 | Quaternion q1 = Quaternion.CreateFromAxisAngle(new Vector3(1, 0, 0), 1.5707f); |
2201 | Quaternion q2 = Quaternion.FromAngleAxis(1.5707f, new Vector3(0, 1, 0)); | 2196 | Quaternion q2 = Quaternion.CreateFromAxisAngle(new Vector3(0, 1, 0), 1.5707f); |
2202 | //Axiom.Math.Quaternion q3 = Axiom.Math.Quaternion.FromAngleAxis(3.14f, new Axiom.Math.Vector3(0, 0, 1)); | 2197 | //Axiom.Math.Quaternion q3 = Axiom.Math.Quaternion.FromAngleAxis(3.14f, new Axiom.Math.Vector3(0, 0, 1)); |
2203 | 2198 | ||
2204 | q1 = q1 * q2; | 2199 | q1 = q1 * q2; |
2205 | //q1 = q1 * q3; | 2200 | //q1 = q1 * q3; |
2206 | Vector3 v3 = new Vector3(); | 2201 | Vector3 v3; |
2207 | float angle = 0; | 2202 | float angle; |
2208 | q1.ToAngleAxis(ref angle, ref v3); | 2203 | q1.GetAxisAngle(out v3, out angle); |
2209 | 2204 | ||
2210 | d.RFromAxisAndAngle(out R, v3.x, v3.y, v3.z, angle); | 2205 | d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle); |
2211 | d.GeomSetRotation(WaterGeom, ref R); | 2206 | d.GeomSetRotation(WaterGeom, ref R); |
2212 | d.GeomSetPosition(WaterGeom, 128, 128, 0); | 2207 | d.GeomSetPosition(WaterGeom, 128, 128, 0); |
2213 | } | 2208 | } |
diff --git a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs index c674d15..400280f 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs | |||
@@ -27,8 +27,8 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using Axiom.Math; | ||
31 | using Nini.Config; | 30 | using Nini.Config; |
31 | using OpenMetaverse; | ||
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Region.Physics.Manager; | 33 | using OpenSim.Region.Physics.Manager; |
34 | 34 | ||
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs index 65f10f9..c8cbcf5 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs | |||
@@ -27,7 +27,6 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using Axiom.Math; | ||
31 | using Nini.Config; | 30 | using Nini.Config; |
32 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
33 | using OpenSim.Region.Physics.Manager; | 32 | using OpenSim.Region.Physics.Manager; |
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs index fed67dd..69cd19c 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs | |||
@@ -27,8 +27,8 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using Axiom.Math; | ||
31 | using Nini.Config; | 30 | using Nini.Config; |
31 | using OpenMetaverse; | ||
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Region.Physics.Manager; | 33 | using OpenSim.Region.Physics.Manager; |
34 | 34 | ||
diff --git a/OpenSim/Region/Physics/POSPlugin/POSScene.cs b/OpenSim/Region/Physics/POSPlugin/POSScene.cs index a32021d..9771a62 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSScene.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSScene.cs | |||
@@ -27,8 +27,8 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using Axiom.Math; | ||
31 | using Nini.Config; | 30 | using Nini.Config; |
31 | using OpenMetaverse; | ||
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Region.Physics.Manager; | 33 | using OpenSim.Region.Physics.Manager; |
34 | 34 | ||
@@ -109,14 +109,13 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
109 | 109 | ||
110 | private bool isColliding(POSCharacter c, POSPrim p) | 110 | private bool isColliding(POSCharacter c, POSPrim p) |
111 | { | 111 | { |
112 | Vector3 rotatedPos = p.Orientation.Inverse() * | 112 | Vector3 rotatedPos = new Vector3(c.Position.X - p.Position.X, c.Position.Y - p.Position.Y, |
113 | new Vector3(c.Position.X - p.Position.X, c.Position.Y - p.Position.Y, | 113 | c.Position.Z - p.Position.Z) * Quaternion.Inverse(p.Orientation); |
114 | c.Position.Z - p.Position.Z); | 114 | Vector3 avatarSize = new Vector3(c.Size.X, c.Size.Y, c.Size.Z) * Quaternion.Inverse(p.Orientation); |
115 | Vector3 avatarSize = p.Orientation.Inverse()*new Vector3(c.Size.X, c.Size.Y, c.Size.Z); | 115 | |
116 | 116 | if (Math.Abs(rotatedPos.X) >= (p.Size.X*0.5 + Math.Abs(avatarSize.X)) || | |
117 | if (Math.Abs(rotatedPos.x) >= (p.Size.X*0.5 + Math.Abs(avatarSize.x)) || | 117 | Math.Abs(rotatedPos.Y) >= (p.Size.Y*0.5 + Math.Abs(avatarSize.Y)) || |
118 | Math.Abs(rotatedPos.y) >= (p.Size.Y*0.5 + Math.Abs(avatarSize.y)) || | 118 | Math.Abs(rotatedPos.Z) >= (p.Size.Z*0.5 + Math.Abs(avatarSize.Z))) |
119 | Math.Abs(rotatedPos.z) >= (p.Size.Z*0.5 + Math.Abs(avatarSize.z))) | ||
120 | { | 119 | { |
121 | return false; | 120 | return false; |
122 | } | 121 | } |
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs index 197da0a..37e2a2f 100644 --- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs +++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs | |||
@@ -31,7 +31,7 @@ using Nini.Config; | |||
31 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
32 | using OpenSim.Region.Physics.Manager; | 32 | using OpenSim.Region.Physics.Manager; |
33 | using PhysXWrapper; | 33 | using PhysXWrapper; |
34 | using Quaternion=Axiom.Math.Quaternion; | 34 | using Quaternion=OpenMetaverse.Quaternion; |
35 | 35 | ||
36 | namespace OpenSim.Region.Physics.PhysXPlugin | 36 | namespace OpenSim.Region.Physics.PhysXPlugin |
37 | { | 37 | { |
@@ -614,12 +614,12 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
614 | { | 614 | { |
615 | get | 615 | get |
616 | { | 616 | { |
617 | Quaternion res = new Quaternion(); | 617 | Quaternion res; |
618 | PhysXWrapper.Quaternion quat = _prim.GetOrientation(); | 618 | PhysXWrapper.Quaternion quat = _prim.GetOrientation(); |
619 | res.w = quat.W; | 619 | res.W = quat.W; |
620 | res.x = quat.X; | 620 | res.X = quat.X; |
621 | res.y = quat.Y; | 621 | res.Y = quat.Y; |
622 | res.z = quat.Z; | 622 | res.Z = quat.Z; |
623 | return res; | 623 | return res; |
624 | } | 624 | } |
625 | set { } | 625 | set { } |