aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorUbitUmarov2012-03-21 01:46:41 +0000
committerUbitUmarov2012-03-21 01:46:41 +0000
commit11ed932263161d1dbea99d4a5699ba6d00894053 (patch)
tree85e26ea10f899ff4a52b7a0c9000daa808cf8282 /OpenSim
parentadd convex state to mesh key, so a change is detected. (diff)
downloadopensim-SC-11ed932263161d1dbea99d4a5699ba6d00894053.zip
opensim-SC-11ed932263161d1dbea99d4a5699ba6d00894053.tar.gz
opensim-SC-11ed932263161d1dbea99d4a5699ba6d00894053.tar.bz2
opensim-SC-11ed932263161d1dbea99d4a5699ba6d00894053.tar.xz
Tell physics about physics shape when creating. Added some virtual methods to get/set density,gravmod, frition,bounce and shape type ( not in use ). UbitOde now should do convex type on creation or everytime the mesh is changed ( as in change size, shape, etc )
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs2
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsActor.cs7
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsScene.cs7
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs14
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs32
5 files changed, 57 insertions, 5 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 85d2bee..a494864 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1832,6 +1832,7 @@ namespace OpenSim.Region.Framework.Scenes
1832 GetWorldRotation(), 1832 GetWorldRotation(),
1833 isPhysical, 1833 isPhysical,
1834 isPhantom, 1834 isPhantom,
1835 PhysicsShapeType,
1835 m_localId); 1836 m_localId);
1836 } 1837 }
1837 catch 1838 catch
@@ -4732,6 +4733,7 @@ namespace OpenSim.Region.Framework.Scenes
4732 GetWorldRotation(), //physics wants world rotation like all other functions send 4733 GetWorldRotation(), //physics wants world rotation like all other functions send
4733 UsePhysics, 4734 UsePhysics,
4734 SetPhantom, 4735 SetPhantom,
4736 PhysicsShapeType,
4735 m_localId); 4737 m_localId);
4736 4738
4737 PhysActor.SetMaterial(Material); 4739 PhysActor.SetMaterial(Material);
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
index bd80fff..be67204 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
@@ -172,6 +172,8 @@ namespace OpenSim.Region.Physics.Manager
172 172
173 public virtual bool Phantom { get; set; } 173 public virtual bool Phantom { get; set; }
174 174
175 public virtual byte PhysicsShapeType { get; set; }
176
175 public abstract PrimitiveBaseShape Shape { set; } 177 public abstract PrimitiveBaseShape Shape { set; }
176 178
177 uint m_baseLocalID; 179 uint m_baseLocalID;
@@ -252,6 +254,11 @@ namespace OpenSim.Region.Physics.Manager
252 { 254 {
253 } 255 }
254 256
257 public virtual float Density { get; set; }
258 public virtual float GravModifier { get; set; }
259 public virtual float Friction { get; set; }
260 public virtual float Bounce { get; set; }
261
255 /// <summary> 262 /// <summary>
256 /// Position of this actor. 263 /// Position of this actor.
257 /// </summary> 264 /// </summary>
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
index eca6a0f..f2c0c28 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
@@ -137,6 +137,13 @@ namespace OpenSim.Region.Physics.Manager
137 return AddPrimShape(primName, pbs, position, size, rotation, isPhysical, localid); 137 return AddPrimShape(primName, pbs, position, size, rotation, isPhysical, localid);
138 } 138 }
139 139
140
141 public virtual PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
142 Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, byte shapetype, uint localid)
143 {
144 return AddPrimShape(primName, pbs, position, size, rotation, isPhysical, localid);
145 }
146
140 public virtual float TimeDilation 147 public virtual float TimeDilation
141 { 148 {
142 get { return 1.0f; } 149 get { return 1.0f; }
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
index 39b89d3..fd2f88f 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
@@ -163,7 +163,7 @@ namespace OpenSim.Region.Physics.OdePlugin
163 public IntPtr collide_geom; // for objects: geom if single prim space it linkset 163 public IntPtr collide_geom; // for objects: geom if single prim space it linkset
164 164
165 private float m_density = 10.000006836f; // Aluminum g/cm3; 165 private float m_density = 10.000006836f; // Aluminum g/cm3;
166 166 private byte m_shapetype;
167 public bool _zeroFlag; 167 public bool _zeroFlag;
168 private bool m_lastUpdateSent; 168 private bool m_lastUpdateSent;
169 169
@@ -846,7 +846,7 @@ namespace OpenSim.Region.Physics.OdePlugin
846 846
847 847
848 public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size, 848 public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size,
849 Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical,bool pisPhantom,uint plocalID) 849 Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical,bool pisPhantom,byte _shapeType,uint plocalID)
850 { 850 {
851 Name = primName; 851 Name = primName;
852 LocalID = plocalID; 852 LocalID = plocalID;
@@ -920,6 +920,8 @@ namespace OpenSim.Region.Physics.OdePlugin
920 hasOOBoffsetFromMesh = false; 920 hasOOBoffsetFromMesh = false;
921 _triMeshData = IntPtr.Zero; 921 _triMeshData = IntPtr.Zero;
922 922
923 m_shapetype = _shapeType;
924
923 m_lastdoneSelected = false; 925 m_lastdoneSelected = false;
924 m_isSelected = false; 926 m_isSelected = false;
925 m_delaySelect = false; 927 m_delaySelect = false;
@@ -1050,7 +1052,13 @@ namespace OpenSim.Region.Physics.OdePlugin
1050 } 1052 }
1051 } 1053 }
1052 1054
1053 IMesh mesh = _parent_scene.mesher.CreateMesh(Name, _pbs, _size, (int)LevelOfDetail.High, true); 1055 bool convex;
1056 if (m_shapetype == 0)
1057 convex = false;
1058 else
1059 convex = true;
1060
1061 IMesh mesh = _parent_scene.mesher.CreateMesh(Name, _pbs, _size, (int)LevelOfDetail.High, true,convex);
1054 if (mesh == null) 1062 if (mesh == null)
1055 { 1063 {
1056 m_log.WarnFormat("[PHYSICS]: CreateMesh Failed on prim {0} at <{1},{2},{3}>.", Name, _position.X, _position.Y, _position.Z); 1064 m_log.WarnFormat("[PHYSICS]: CreateMesh Failed on prim {0} at <{1},{2},{3}>.", Name, _position.X, _position.Y, _position.Z);
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
index 612eafd..76d7746 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
@@ -1141,7 +1141,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1141 OdePrim newPrim; 1141 OdePrim newPrim;
1142 lock (OdeLock) 1142 lock (OdeLock)
1143 { 1143 {
1144 newPrim = new OdePrim(name, this, pos, siz, rot, pbs, isphysical,false,localID); 1144 newPrim = new OdePrim(name, this, pos, siz, rot, pbs, isphysical,false,0,localID);
1145 1145
1146 lock (_prims) 1146 lock (_prims)
1147 _prims.Add(newPrim); 1147 _prims.Add(newPrim);
@@ -1159,7 +1159,25 @@ namespace OpenSim.Region.Physics.OdePlugin
1159 OdePrim newPrim; 1159 OdePrim newPrim;
1160 lock (OdeLock) 1160 lock (OdeLock)
1161 { 1161 {
1162 newPrim = new OdePrim(name, this, pos, siz, rot, pbs, isphysical,isPhantom,localID); 1162 newPrim = new OdePrim(name, this, pos, siz, rot, pbs, isphysical, isPhantom, 0, localID);
1163
1164 lock (_prims)
1165 _prims.Add(newPrim);
1166 }
1167 return newPrim;
1168 }
1169
1170 private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation,
1171 PrimitiveBaseShape pbs, bool isphysical, bool isPhantom, byte shapeType, uint localID)
1172 {
1173 Vector3 pos = position;
1174 Vector3 siz = size;
1175 Quaternion rot = rotation;
1176
1177 OdePrim newPrim;
1178 lock (OdeLock)
1179 {
1180 newPrim = new OdePrim(name, this, pos, siz, rot, pbs, isphysical, isPhantom, shapeType, localID);
1163 1181
1164 lock (_prims) 1182 lock (_prims)
1165 _prims.Add(newPrim); 1183 _prims.Add(newPrim);
@@ -1203,6 +1221,16 @@ namespace OpenSim.Region.Physics.OdePlugin
1203 return AddPrim(primName, position, size, rotation, pbs, isPhysical, localid); 1221 return AddPrim(primName, position, size, rotation, pbs, isPhysical, localid);
1204 } 1222 }
1205 1223
1224 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
1225 Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, byte shapeType, uint localid)
1226 {
1227#if SPAM
1228 m_log.DebugFormat("[PHYSICS]: Adding physics actor to {0}", primName);
1229#endif
1230
1231 return AddPrim(primName, position, size, rotation, pbs, isPhysical,isPhantom, shapeType, localid);
1232 }
1233
1206 public override float TimeDilation 1234 public override float TimeDilation
1207 { 1235 {
1208 get { return m_timeDilation; } 1236 get { return m_timeDilation; }