diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | 325 | ||||
-rw-r--r-- | OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | 7 |
2 files changed, 200 insertions, 132 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs index 073c37f..53a39d7 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | |||
@@ -25,7 +25,7 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | /* Revision 2011 by Ubit Umarov | 28 | /* Revision 2011/12 by Ubit Umarov |
29 | * | 29 | * |
30 | * | 30 | * |
31 | */ | 31 | */ |
@@ -190,7 +190,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
190 | public ODEDynamics m_vehicle; | 190 | public ODEDynamics m_vehicle; |
191 | 191 | ||
192 | internal int m_material = (int)Material.Wood; | 192 | internal int m_material = (int)Material.Wood; |
193 | protected ContactData primContactData = new ContactData { mu = 0f, bounce = 0.1f}; | 193 | protected ContactData primContactData = new ContactData { mu = 0f, bounce = 0.1f }; |
194 | 194 | ||
195 | /// <summary> | 195 | /// <summary> |
196 | /// Is this prim subject to physics? Even if not, it's still solid for collision purposes. | 196 | /// Is this prim subject to physics? Even if not, it's still solid for collision purposes. |
@@ -209,7 +209,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
209 | AddChange(changes.Physical, value); | 209 | AddChange(changes.Physical, value); |
210 | } | 210 | } |
211 | } | 211 | } |
212 | 212 | ||
213 | public override bool Building // this is not reliable for internal use | 213 | public override bool Building // this is not reliable for internal use |
214 | { | 214 | { |
215 | get { return m_building; } | 215 | get { return m_building; } |
@@ -225,23 +225,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
225 | { | 225 | { |
226 | get | 226 | get |
227 | { | 227 | { |
228 | /* | 228 | return primContactData; |
229 | ODEDynamics v; | ||
230 | if(childPrim && _parent !=null) | ||
231 | { | ||
232 | v =((OdePrim)_parent).m_vehicle; | ||
233 | if(v != null && v.Type != Vehicle.TYPE_NONE) | ||
234 | return v.VehiculeContactData; | ||
235 | return primContactData; | ||
236 | } | ||
237 | |||
238 | if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) | ||
239 | return m_vehicle.VehiculeContactData; | ||
240 | */ | ||
241 | return primContactData; | ||
242 | } | 229 | } |
243 | } | 230 | } |
244 | 231 | ||
245 | public override int PhysicsActorType | 232 | public override int PhysicsActorType |
246 | { | 233 | { |
247 | get { return (int)ActorTypes.Prim; } | 234 | get { return (int)ActorTypes.Prim; } |
@@ -276,11 +263,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
276 | { | 263 | { |
277 | set | 264 | set |
278 | { | 265 | { |
279 | if(value) | 266 | if (value) |
280 | m_isSelected = value; | 267 | m_isSelected = value; |
281 | AddChange(changes.Selected, value); | 268 | AddChange(changes.Selected, value); |
282 | } | 269 | } |
283 | } | 270 | } |
284 | 271 | ||
285 | public override bool Flying | 272 | public override bool Flying |
286 | { | 273 | { |
@@ -400,10 +387,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
400 | } | 387 | } |
401 | } | 388 | } |
402 | 389 | ||
403 | |||
404 | public override void SetVolumeDetect(int param) | 390 | public override void SetVolumeDetect(int param) |
405 | { | 391 | { |
406 | AddChange(changes.VolumeDtc,(param != 0)); | 392 | AddChange(changes.VolumeDtc, (param != 0)); |
407 | } | 393 | } |
408 | 394 | ||
409 | public override Vector3 GeometricCenter | 395 | public override Vector3 GeometricCenter |
@@ -483,14 +469,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
483 | // client object interpolation works a 'little' better | 469 | // client object interpolation works a 'little' better |
484 | if (_zeroFlag) | 470 | if (_zeroFlag) |
485 | return Vector3.Zero; | 471 | return Vector3.Zero; |
486 | /* | ||
487 | Vector3 returnVelocity = Vector3.Zero; | ||
488 | returnVelocity.X = (m_lastVelocity.X + _velocity.X) / 2; | ||
489 | returnVelocity.Y = (m_lastVelocity.Y + _velocity.Y) / 2; | ||
490 | returnVelocity.Z = (m_lastVelocity.Z + _velocity.Z) / 2; | ||
491 | |||
492 | return returnVelocity; | ||
493 | */ | ||
494 | return _velocity; | 472 | return _velocity; |
495 | } | 473 | } |
496 | set | 474 | set |
@@ -498,7 +476,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
498 | if (value.IsFinite()) | 476 | if (value.IsFinite()) |
499 | { | 477 | { |
500 | AddChange(changes.Velocity, value); | 478 | AddChange(changes.Velocity, value); |
501 | // _velocity = value; | 479 | // _velocity = value; |
502 | 480 | ||
503 | } | 481 | } |
504 | else | 482 | else |
@@ -548,7 +526,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
548 | { | 526 | { |
549 | get | 527 | get |
550 | { | 528 | { |
551 | if (givefakeori>0) | 529 | if (givefakeori > 0) |
552 | return fakeori; | 530 | return fakeori; |
553 | else | 531 | else |
554 | 532 | ||
@@ -603,7 +581,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
603 | } | 581 | } |
604 | } | 582 | } |
605 | 583 | ||
606 | 584 | ||
607 | public override float Buoyancy | 585 | public override float Buoyancy |
608 | { | 586 | { |
609 | get { return m_buoyancy; } | 587 | get { return m_buoyancy; } |
@@ -652,6 +630,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
652 | 630 | ||
653 | public override int VehicleType | 631 | public override int VehicleType |
654 | { | 632 | { |
633 | // we may need to put a fake on this | ||
655 | get | 634 | get |
656 | { | 635 | { |
657 | if (m_vehicle == null) | 636 | if (m_vehicle == null) |
@@ -661,44 +640,32 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
661 | } | 640 | } |
662 | set | 641 | set |
663 | { | 642 | { |
664 | if (m_vehicle == null) | 643 | AddChange(changes.VehicleType, value); |
665 | { | ||
666 | if (value != (int)Vehicle.TYPE_NONE) | ||
667 | { | ||
668 | m_vehicle = new ODEDynamics(this); | ||
669 | m_vehicle.ProcessTypeChange((Vehicle)value); | ||
670 | } | ||
671 | } | ||
672 | else | ||
673 | m_vehicle.ProcessTypeChange((Vehicle)value); | ||
674 | } | 644 | } |
675 | } | 645 | } |
676 | 646 | ||
677 | public override void VehicleFloatParam(int param, float value) | 647 | public override void VehicleFloatParam(int param, float value) |
678 | { | 648 | { |
679 | if (m_vehicle == null) | 649 | strVehicleFloatParam fp = new strVehicleFloatParam(); |
680 | return; | 650 | fp.param = param; |
681 | m_vehicle.ProcessFloatVehicleParam((Vehicle)param, value); | 651 | fp.value = value; |
682 | if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) | 652 | AddChange(changes.VehicleFloatParam, fp); |
683 | d.BodyEnable(Body); | ||
684 | } | 653 | } |
685 | 654 | ||
686 | public override void VehicleVectorParam(int param, Vector3 value) | 655 | public override void VehicleVectorParam(int param, Vector3 value) |
687 | { | 656 | { |
688 | if (m_vehicle == null) | 657 | strVehicleVectorParam fp = new strVehicleVectorParam(); |
689 | return; | 658 | fp.param = param; |
690 | m_vehicle.ProcessVectorVehicleParam((Vehicle)param, value); | 659 | fp.value = value; |
691 | if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) | 660 | AddChange(changes.VehicleVectorParam, fp); |
692 | d.BodyEnable(Body); | ||
693 | } | 661 | } |
694 | 662 | ||
695 | public override void VehicleRotationParam(int param, Quaternion rotation) | 663 | public override void VehicleRotationParam(int param, Quaternion value) |
696 | { | 664 | { |
697 | if (m_vehicle == null) | 665 | strVehicleQuatParam fp = new strVehicleQuatParam(); |
698 | return; | 666 | fp.param = param; |
699 | m_vehicle.ProcessRotationVehicleParam((Vehicle)param, rotation); | 667 | fp.value = value; |
700 | if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) | 668 | AddChange(changes.VehicleVectorParam, fp); |
701 | d.BodyEnable(Body); | ||
702 | } | 669 | } |
703 | 670 | ||
704 | public override void VehicleFlags(int param, bool remove) | 671 | public override void VehicleFlags(int param, bool remove) |
@@ -829,7 +796,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
829 | return false; | 796 | return false; |
830 | } | 797 | } |
831 | 798 | ||
832 | 799 | ||
833 | public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size, | 800 | public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size, |
834 | Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical) | 801 | Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical) |
835 | { | 802 | { |
@@ -866,7 +833,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
866 | if (size.Z <= 0) size.Z = 0.01f; | 833 | if (size.Z <= 0) size.Z = 0.01f; |
867 | 834 | ||
868 | _size = size; | 835 | _size = size; |
869 | 836 | ||
870 | 837 | ||
871 | if (!QuaternionIsFinite(rotation)) | 838 | if (!QuaternionIsFinite(rotation)) |
872 | { | 839 | { |
@@ -1023,7 +990,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1023 | if (_parent != null) | 990 | if (_parent != null) |
1024 | { | 991 | { |
1025 | OdePrim parent = (OdePrim)_parent; | 992 | OdePrim parent = (OdePrim)_parent; |
1026 | parent.ChildDelink(this,false); | 993 | parent.ChildDelink(this, false); |
1027 | } | 994 | } |
1028 | } | 995 | } |
1029 | else | 996 | else |
@@ -1093,23 +1060,23 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1093 | _parent_scene.geom_name_map[prim_geom] = Name; | 1060 | _parent_scene.geom_name_map[prim_geom] = Name; |
1094 | _parent_scene.actor_name_map[prim_geom] = this; | 1061 | _parent_scene.actor_name_map[prim_geom] = this; |
1095 | 1062 | ||
1096 | /* | 1063 | /* |
1097 | if (childPrim) | 1064 | if (childPrim) |
1098 | { | 1065 | { |
1099 | if (_parent != null && _parent is OdePrim) | 1066 | if (_parent != null && _parent is OdePrim) |
1100 | { | 1067 | { |
1101 | OdePrim parent = (OdePrim)_parent; | 1068 | OdePrim parent = (OdePrim)_parent; |
1102 | //Console.WriteLine("SetGeom calls ChildSetGeom"); | 1069 | //Console.WriteLine("SetGeom calls ChildSetGeom"); |
1103 | parent.ChildSetGeom(this); | 1070 | parent.ChildSetGeom(this); |
1104 | } | 1071 | } |
1105 | } | 1072 | } |
1106 | */ | 1073 | */ |
1107 | } | 1074 | } |
1108 | else | 1075 | else |
1109 | m_log.Warn("Setting bad Geom"); | 1076 | m_log.Warn("Setting bad Geom"); |
1110 | } | 1077 | } |
1111 | 1078 | ||
1112 | 1079 | ||
1113 | /// <summary> | 1080 | /// <summary> |
1114 | /// Create a geometry for the given mesh in the given target space. | 1081 | /// Create a geometry for the given mesh in the given target space. |
1115 | /// </summary> | 1082 | /// </summary> |
@@ -1128,10 +1095,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1128 | 1095 | ||
1129 | if (_parent_scene.needsMeshing(_pbs)) | 1096 | if (_parent_scene.needsMeshing(_pbs)) |
1130 | { | 1097 | { |
1131 | haveMesh = setMesh(_parent_scene); // this will give a mesh to non trivial known prims | 1098 | haveMesh = setMesh(_parent_scene); // this will give a mesh to non trivial known prims |
1132 | } | 1099 | } |
1133 | 1100 | ||
1134 | if(!haveMesh) | 1101 | if (!haveMesh) |
1135 | { | 1102 | { |
1136 | if (_pbs.ProfileShape == ProfileShape.HalfCircle && _pbs.PathCurve == (byte)Extrusion.Curve1 | 1103 | if (_pbs.ProfileShape == ProfileShape.HalfCircle && _pbs.PathCurve == (byte)Extrusion.Curve1 |
1137 | && _size.X == _size.Y && _size.Y == _size.Z) | 1104 | && _size.X == _size.Y && _size.Y == _size.Z) |
@@ -1186,7 +1153,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1186 | // catch (System.AccessViolationException) | 1153 | // catch (System.AccessViolationException) |
1187 | catch (Exception e) | 1154 | catch (Exception e) |
1188 | { | 1155 | { |
1189 | m_log.ErrorFormat("[PHYSICS]: PrimGeom destruction failed for {0} exception {1}", Name,e); | 1156 | m_log.ErrorFormat("[PHYSICS]: PrimGeom destruction failed for {0} exception {1}", Name, e); |
1190 | } | 1157 | } |
1191 | 1158 | ||
1192 | prim_geom = IntPtr.Zero; | 1159 | prim_geom = IntPtr.Zero; |
@@ -1526,7 +1493,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1526 | } | 1493 | } |
1527 | 1494 | ||
1528 | #region Mass Calculation | 1495 | #region Mass Calculation |
1529 | 1496 | ||
1530 | private float CalculatePrimVolume() | 1497 | private float CalculatePrimVolume() |
1531 | { | 1498 | { |
1532 | float volume = _size.X * _size.Y * _size.Z; // default | 1499 | float volume = _size.X * _size.Y * _size.Z; // default |
@@ -1885,7 +1852,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1885 | { | 1852 | { |
1886 | if (prm.prim_geom != IntPtr.Zero) | 1853 | if (prm.prim_geom != IntPtr.Zero) |
1887 | d.GeomSetBody(prm.prim_geom, IntPtr.Zero); | 1854 | d.GeomSetBody(prm.prim_geom, IntPtr.Zero); |
1888 | if(prm.Body != prim.Body) | 1855 | if (prm.Body != prim.Body) |
1889 | prm.DestroyBody(); // don't loose bodies around | 1856 | prm.DestroyBody(); // don't loose bodies around |
1890 | prm.Body = IntPtr.Zero; | 1857 | prm.Body = IntPtr.Zero; |
1891 | } | 1858 | } |
@@ -2057,21 +2024,21 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2057 | SetInStaticSpace(this); | 2024 | SetInStaticSpace(this); |
2058 | } | 2025 | } |
2059 | 2026 | ||
2060 | // m_building = false; // REMOVE THIS LATER | 2027 | // m_building = false; // REMOVE THIS LATER |
2061 | 2028 | ||
2062 | 2029 | ||
2063 | if (m_isphysical && Body == IntPtr.Zero) | 2030 | if (m_isphysical && Body == IntPtr.Zero) |
2064 | { | 2031 | { |
2065 | /* | 2032 | /* |
2066 | if (_pbs.SculptEntry && _parent_scene.meshSculptedPrim) | 2033 | if (_pbs.SculptEntry && _parent_scene.meshSculptedPrim) |
2067 | { | 2034 | { |
2068 | changeShape(_pbs); | 2035 | changeShape(_pbs); |
2069 | } | 2036 | } |
2070 | else | 2037 | else |
2071 | { | 2038 | { |
2072 | */ | 2039 | */ |
2073 | MakeBody(); | 2040 | MakeBody(); |
2074 | // } | 2041 | // } |
2075 | } | 2042 | } |
2076 | } | 2043 | } |
2077 | 2044 | ||
@@ -2114,7 +2081,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2114 | { | 2081 | { |
2115 | if (NewParent != _parent) | 2082 | if (NewParent != _parent) |
2116 | { | 2083 | { |
2117 | (_parent as OdePrim).ChildDelink(this,false); // for now... | 2084 | (_parent as OdePrim).ChildDelink(this, false); // for now... |
2118 | childPrim = false; | 2085 | childPrim = false; |
2119 | 2086 | ||
2120 | if (NewParent != null) | 2087 | if (NewParent != null) |
@@ -2130,7 +2097,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2130 | 2097 | ||
2131 | private void Stop() | 2098 | private void Stop() |
2132 | { | 2099 | { |
2133 | if(!childPrim) | 2100 | if (!childPrim) |
2134 | { | 2101 | { |
2135 | m_force = Vector3.Zero; | 2102 | m_force = Vector3.Zero; |
2136 | m_forceacc = Vector3.Zero; | 2103 | m_forceacc = Vector3.Zero; |
@@ -2138,7 +2105,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2138 | _torque = Vector3.Zero; | 2105 | _torque = Vector3.Zero; |
2139 | _velocity = Vector3.Zero; | 2106 | _velocity = Vector3.Zero; |
2140 | _acceleration = Vector3.Zero; | 2107 | _acceleration = Vector3.Zero; |
2141 | m_rotationalVelocity = Vector3.Zero; | 2108 | m_rotationalVelocity = Vector3.Zero; |
2142 | _target_velocity = Vector3.Zero; | 2109 | _target_velocity = Vector3.Zero; |
2143 | if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) | 2110 | if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) |
2144 | m_vehicle.Stop(); | 2111 | m_vehicle.Stop(); |
@@ -2150,7 +2117,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2150 | d.BodySetTorque(Body, 0f, 0f, 0f); | 2117 | d.BodySetTorque(Body, 0f, 0f, 0f); |
2151 | d.BodySetLinearVel(Body, 0f, 0f, 0f); | 2118 | d.BodySetLinearVel(Body, 0f, 0f, 0f); |
2152 | d.BodySetAngularVel(Body, 0f, 0f, 0f); | 2119 | d.BodySetAngularVel(Body, 0f, 0f, 0f); |
2153 | 2120 | ||
2154 | } | 2121 | } |
2155 | } | 2122 | } |
2156 | 2123 | ||
@@ -2236,7 +2203,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2236 | givefakepos--; | 2203 | givefakepos--; |
2237 | if (givefakepos < 0) | 2204 | if (givefakepos < 0) |
2238 | givefakepos = 0; | 2205 | givefakepos = 0; |
2239 | // changeSelectedStatus(); | 2206 | // changeSelectedStatus(); |
2240 | resetCollisionAccounting(); | 2207 | resetCollisionAccounting(); |
2241 | } | 2208 | } |
2242 | 2209 | ||
@@ -2381,17 +2348,17 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2381 | 2348 | ||
2382 | if (!childPrim) | 2349 | if (!childPrim) |
2383 | { | 2350 | { |
2384 | if (NewStatus) | 2351 | if (NewStatus) |
2385 | { | 2352 | { |
2386 | if (Body == IntPtr.Zero) | 2353 | if (Body == IntPtr.Zero) |
2387 | { | 2354 | { |
2388 | /* | 2355 | /* |
2389 | if (_pbs.SculptEntry && _parent_scene.meshSculptedPrim) | 2356 | if (_pbs.SculptEntry && _parent_scene.meshSculptedPrim) |
2390 | { | 2357 | { |
2391 | changeShape(_pbs); | 2358 | changeShape(_pbs); |
2392 | } | 2359 | } |
2393 | else | 2360 | else |
2394 | */ | 2361 | */ |
2395 | { | 2362 | { |
2396 | MakeBody(); | 2363 | MakeBody(); |
2397 | } | 2364 | } |
@@ -2402,13 +2369,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2402 | if (Body != IntPtr.Zero) | 2369 | if (Body != IntPtr.Zero) |
2403 | { | 2370 | { |
2404 | // UpdateChildsfromgeom(); | 2371 | // UpdateChildsfromgeom(); |
2405 | /* if (_pbs.SculptEntry && _parent_scene.meshSculptedPrim) | 2372 | /* if (_pbs.SculptEntry && _parent_scene.meshSculptedPrim) |
2406 | { | 2373 | { |
2407 | changeShape(_pbs); | 2374 | changeShape(_pbs); |
2408 | } | 2375 | } |
2409 | else | 2376 | else |
2410 | */ | 2377 | */ |
2411 | DestroyBody(); | 2378 | DestroyBody(); |
2412 | } | 2379 | } |
2413 | } | 2380 | } |
2414 | } | 2381 | } |
@@ -2417,7 +2384,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2417 | } | 2384 | } |
2418 | 2385 | ||
2419 | private void changeprimsizeshape() | 2386 | private void changeprimsizeshape() |
2420 | { | 2387 | { |
2421 | OdePrim parent = (OdePrim)_parent; | 2388 | OdePrim parent = (OdePrim)_parent; |
2422 | 2389 | ||
2423 | bool chp = childPrim; | 2390 | bool chp = childPrim; |
@@ -2609,6 +2576,57 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2609 | } | 2576 | } |
2610 | } | 2577 | } |
2611 | 2578 | ||
2579 | private void changeVehicleType(int value) | ||
2580 | { | ||
2581 | if (m_vehicle == null) | ||
2582 | { | ||
2583 | if (value != (int)Vehicle.TYPE_NONE) | ||
2584 | { | ||
2585 | m_vehicle = new ODEDynamics(this); | ||
2586 | m_vehicle.ProcessTypeChange((Vehicle)value); | ||
2587 | } | ||
2588 | } | ||
2589 | else | ||
2590 | m_vehicle.ProcessTypeChange((Vehicle)value); | ||
2591 | } | ||
2592 | |||
2593 | private void changeVehicleFloatParam(strVehicleFloatParam fp) | ||
2594 | { | ||
2595 | if (m_vehicle == null) | ||
2596 | return; | ||
2597 | |||
2598 | m_vehicle.ProcessFloatVehicleParam((Vehicle)fp.param, fp.value); | ||
2599 | if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) | ||
2600 | d.BodyEnable(Body); | ||
2601 | } | ||
2602 | |||
2603 | private void changeVehicleVectorParam(strVehicleVectorParam vp) | ||
2604 | { | ||
2605 | if (m_vehicle == null) | ||
2606 | return; | ||
2607 | m_vehicle.ProcessVectorVehicleParam((Vehicle)vp.param, vp.value); | ||
2608 | if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) | ||
2609 | d.BodyEnable(Body); | ||
2610 | } | ||
2611 | |||
2612 | private void changeVehicleRotationParam(strVehicleQuatParam qp) | ||
2613 | { | ||
2614 | if (m_vehicle == null) | ||
2615 | return; | ||
2616 | m_vehicle.ProcessRotationVehicleParam((Vehicle)qp.param, qp.value); | ||
2617 | if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) | ||
2618 | d.BodyEnable(Body); | ||
2619 | } | ||
2620 | |||
2621 | private void changeVehicleFlags(strVehicleBoolParam bp) | ||
2622 | { | ||
2623 | if (m_vehicle == null) | ||
2624 | return; | ||
2625 | m_vehicle.ProcessVehicleFlags(bp.param, bp.value); | ||
2626 | if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) | ||
2627 | d.BodyEnable(Body); | ||
2628 | } | ||
2629 | |||
2612 | #endregion | 2630 | #endregion |
2613 | 2631 | ||
2614 | public void Move() | 2632 | public void Move() |
@@ -2616,10 +2634,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2616 | if (!childPrim && m_isphysical && Body != IntPtr.Zero && | 2634 | if (!childPrim && m_isphysical && Body != IntPtr.Zero && |
2617 | !m_disabled && !m_isSelected && d.BodyIsEnabled(Body) && !m_building) // KF: Only move root prims. | 2635 | !m_disabled && !m_isSelected && d.BodyIsEnabled(Body) && !m_building) // KF: Only move root prims. |
2618 | { | 2636 | { |
2619 | // if (!d.BodyIsEnabled(Body)) d.BodyEnable(Body); // KF add 161009 | 2637 | // if (!d.BodyIsEnabled(Body)) d.BodyEnable(Body); // KF add 161009 |
2620 | 2638 | ||
2621 | float timestep = _parent_scene.ODE_STEPSIZE; | 2639 | float timestep = _parent_scene.ODE_STEPSIZE; |
2622 | 2640 | ||
2623 | float fx = 0; | 2641 | float fx = 0; |
2624 | float fy = 0; | 2642 | float fy = 0; |
2625 | float fz = 0; | 2643 | float fz = 0; |
@@ -2631,13 +2649,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2631 | } | 2649 | } |
2632 | else | 2650 | else |
2633 | { | 2651 | { |
2634 | float m_mass = _mass; | 2652 | float m_mass = _mass; |
2635 | 2653 | ||
2636 | // fz = 0f; | 2654 | // fz = 0f; |
2637 | //m_log.Info(m_collisionFlags.ToString()); | 2655 | //m_log.Info(m_collisionFlags.ToString()); |
2638 | if (m_usePID) | 2656 | if (m_usePID) |
2639 | { | 2657 | { |
2640 | 2658 | ||
2641 | // If the PID Controller isn't active then we set our force | 2659 | // If the PID Controller isn't active then we set our force |
2642 | // calculating base velocity to the current position | 2660 | // calculating base velocity to the current position |
2643 | 2661 | ||
@@ -2795,7 +2813,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2795 | fz += m_forceacc.Z; | 2813 | fz += m_forceacc.Z; |
2796 | 2814 | ||
2797 | m_forceacc = Vector3.Zero; | 2815 | m_forceacc = Vector3.Zero; |
2798 | 2816 | ||
2799 | //m_log.Info("[OBJPID]: X:" + fx.ToString() + " Y:" + fy.ToString() + " Z:" + fz.ToString()); | 2817 | //m_log.Info("[OBJPID]: X:" + fx.ToString() + " Y:" + fy.ToString() + " Z:" + fz.ToString()); |
2800 | if (fx != 0 || fy != 0 || fz != 0) | 2818 | if (fx != 0 || fy != 0 || fz != 0) |
2801 | { | 2819 | { |
@@ -2871,10 +2889,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2871 | bool lastZeroFlag = _zeroFlag; | 2889 | bool lastZeroFlag = _zeroFlag; |
2872 | 2890 | ||
2873 | d.Vector3 lpos; | 2891 | d.Vector3 lpos; |
2874 | d.GeomCopyPosition(prim_geom,out lpos); // root position that is seem by rest of simulator | 2892 | d.GeomCopyPosition(prim_geom, out lpos); // root position that is seem by rest of simulator |
2875 | 2893 | ||
2876 | // we need to use root position since that's all the rest of scene uses | 2894 | // we need to use root position since that's all the rest of scene uses |
2877 | if ( lpos.X < 0f || lpos.X > _parent_scene.WorldExtents.X | 2895 | if (lpos.X < 0f || lpos.X > _parent_scene.WorldExtents.X |
2878 | || lpos.Y < 0f || lpos.Y > _parent_scene.WorldExtents.Y | 2896 | || lpos.Y < 0f || lpos.Y > _parent_scene.WorldExtents.Y |
2879 | ) | 2897 | ) |
2880 | { | 2898 | { |
@@ -3137,10 +3155,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3137 | if (_parent != null) | 3155 | if (_parent != null) |
3138 | { | 3156 | { |
3139 | OdePrim parent = (OdePrim)_parent; | 3157 | OdePrim parent = (OdePrim)_parent; |
3140 | parent.ChildRemove(this,false); | 3158 | parent.ChildRemove(this, false); |
3141 | } | 3159 | } |
3142 | else | 3160 | else |
3143 | ChildRemove(this,false); | 3161 | ChildRemove(this, false); |
3144 | 3162 | ||
3145 | RemoveGeom(); | 3163 | RemoveGeom(); |
3146 | m_targetSpace = IntPtr.Zero; | 3164 | m_targetSpace = IntPtr.Zero; |
@@ -3177,12 +3195,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3177 | changevelocity((Vector3)arg); | 3195 | changevelocity((Vector3)arg); |
3178 | break; | 3196 | break; |
3179 | 3197 | ||
3180 | // case changes.Acceleration: | 3198 | // case changes.Acceleration: |
3181 | // changeacceleration((Vector3)arg); | 3199 | // changeacceleration((Vector3)arg); |
3182 | // break; | 3200 | // break; |
3183 | // case changes.AngVelocity: | 3201 | // case changes.AngVelocity: |
3184 | // changeangvelocity((Vector3)arg); | 3202 | // changeangvelocity((Vector3)arg); |
3185 | // break; | 3203 | // break; |
3186 | 3204 | ||
3187 | case changes.Force: | 3205 | case changes.Force: |
3188 | changeForce((Vector3)arg); | 3206 | changeForce((Vector3)arg); |
@@ -3209,7 +3227,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3209 | break; | 3227 | break; |
3210 | 3228 | ||
3211 | case changes.Shape: | 3229 | case changes.Shape: |
3212 | changeShape((PrimitiveBaseShape) arg); | 3230 | changeShape((PrimitiveBaseShape)arg); |
3213 | break; | 3231 | break; |
3214 | 3232 | ||
3215 | case changes.CollidesWater: | 3233 | case changes.CollidesWater: |
@@ -3229,13 +3247,33 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3229 | break; | 3247 | break; |
3230 | 3248 | ||
3231 | case changes.disabled: | 3249 | case changes.disabled: |
3232 | changeDisable((bool) arg); | 3250 | changeDisable((bool)arg); |
3233 | break; | 3251 | break; |
3234 | 3252 | ||
3235 | case changes.building: | 3253 | case changes.building: |
3236 | changeBuilding((bool)arg); | 3254 | changeBuilding((bool)arg); |
3237 | break; | 3255 | break; |
3238 | 3256 | ||
3257 | case changes.VehicleType: | ||
3258 | changeVehicleType((int)arg); | ||
3259 | break; | ||
3260 | |||
3261 | case changes.VehicleFlags: | ||
3262 | changeVehicleFlags((strVehicleBoolParam) arg); | ||
3263 | break; | ||
3264 | |||
3265 | case changes.VehicleFloatParam: | ||
3266 | changeVehicleFloatParam((strVehicleFloatParam) arg); | ||
3267 | break; | ||
3268 | |||
3269 | case changes.VehicleVectorParam: | ||
3270 | changeVehicleVectorParam((strVehicleVectorParam) arg); | ||
3271 | break; | ||
3272 | |||
3273 | case changes.VehicleRotationParam: | ||
3274 | changeVehicleRotationParam((strVehicleQuatParam) arg); | ||
3275 | break; | ||
3276 | |||
3239 | case changes.Null: | 3277 | case changes.Null: |
3240 | donullchange(); | 3278 | donullchange(); |
3241 | break; | 3279 | break; |
@@ -3251,5 +3289,30 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3251 | { | 3289 | { |
3252 | _parent_scene.AddChange(this, what, arg); | 3290 | _parent_scene.AddChange(this, what, arg); |
3253 | } | 3291 | } |
3292 | |||
3293 | |||
3294 | private struct strVehicleBoolParam | ||
3295 | { | ||
3296 | public int param; | ||
3297 | public bool value; | ||
3298 | } | ||
3299 | |||
3300 | private struct strVehicleFloatParam | ||
3301 | { | ||
3302 | public int param; | ||
3303 | public float value; | ||
3304 | } | ||
3305 | |||
3306 | private struct strVehicleQuatParam | ||
3307 | { | ||
3308 | public int param; | ||
3309 | public Quaternion value; | ||
3310 | } | ||
3311 | |||
3312 | private struct strVehicleVectorParam | ||
3313 | { | ||
3314 | public int param; | ||
3315 | public Vector3 value; | ||
3316 | } | ||
3254 | } | 3317 | } |
3255 | } | 3318 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs index fc59c32..86385bf 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | |||
@@ -1,4 +1,3 @@ | |||
1 | |||
2 | /* | 1 | /* |
3 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
4 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
@@ -137,6 +136,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
137 | disabled, | 136 | disabled, |
138 | building, | 137 | building, |
139 | 138 | ||
139 | VehicleType, | ||
140 | VehicleFloatParam, | ||
141 | VehicleVectorParam, | ||
142 | VehicleRotationParam, | ||
143 | VehicleFlags, | ||
144 | |||
140 | Null //keep this last used do dim the methods array. does nothing but pulsing the prim | 145 | Null //keep this last used do dim the methods array. does nothing but pulsing the prim |
141 | } | 146 | } |
142 | 147 | ||