diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 190 |
1 files changed, 114 insertions, 76 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index ac92b8b..3bc9957 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -326,7 +326,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
326 | /// Set a new geometry for this prim. | 326 | /// Set a new geometry for this prim. |
327 | /// </summary> | 327 | /// </summary> |
328 | /// <param name="geom"></param> | 328 | /// <param name="geom"></param> |
329 | public void SetGeom(IntPtr geom) | 329 | private void SetGeom(IntPtr geom) |
330 | { | 330 | { |
331 | prim_geom = geom; | 331 | prim_geom = geom; |
332 | //Console.WriteLine("SetGeom to " + prim_geom + " for " + Name); | 332 | //Console.WriteLine("SetGeom to " + prim_geom + " for " + Name); |
@@ -351,7 +351,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
351 | //m_log.Warn("Setting Geom to: " + prim_geom); | 351 | //m_log.Warn("Setting Geom to: " + prim_geom); |
352 | } | 352 | } |
353 | 353 | ||
354 | public void enableBodySoft() | 354 | private void enableBodySoft() |
355 | { | 355 | { |
356 | if (!childPrim) | 356 | if (!childPrim) |
357 | { | 357 | { |
@@ -366,7 +366,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
366 | } | 366 | } |
367 | } | 367 | } |
368 | 368 | ||
369 | public void disableBodySoft() | 369 | private void disableBodySoft() |
370 | { | 370 | { |
371 | m_disabled = true; | 371 | m_disabled = true; |
372 | 372 | ||
@@ -379,7 +379,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
379 | /// <summary> | 379 | /// <summary> |
380 | /// Make a prim subject to physics. | 380 | /// Make a prim subject to physics. |
381 | /// </summary> | 381 | /// </summary> |
382 | public void enableBody() | 382 | private void enableBody() |
383 | { | 383 | { |
384 | // Don't enable this body if we're a child prim | 384 | // Don't enable this body if we're a child prim |
385 | // this should be taken care of in the parent function not here | 385 | // this should be taken care of in the parent function not here |
@@ -423,7 +423,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
423 | m_vehicle.Enable(Body, _parent_scene); | 423 | m_vehicle.Enable(Body, _parent_scene); |
424 | } | 424 | } |
425 | 425 | ||
426 | _parent_scene.addActivePrim(this); | 426 | _parent_scene.ActivatePrim(this); |
427 | } | 427 | } |
428 | } | 428 | } |
429 | 429 | ||
@@ -741,7 +741,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
741 | 741 | ||
742 | #endregion | 742 | #endregion |
743 | 743 | ||
744 | public void setMass() | 744 | private void setMass() |
745 | { | 745 | { |
746 | if (Body != (IntPtr) 0) | 746 | if (Body != (IntPtr) 0) |
747 | { | 747 | { |
@@ -757,7 +757,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
757 | /// <summary> | 757 | /// <summary> |
758 | /// Stop a prim from being subject to physics. | 758 | /// Stop a prim from being subject to physics. |
759 | /// </summary> | 759 | /// </summary> |
760 | public void disableBody() | 760 | internal void disableBody() |
761 | { | 761 | { |
762 | //this kills the body so things like 'mesh' can re-create it. | 762 | //this kills the body so things like 'mesh' can re-create it. |
763 | lock (this) | 763 | lock (this) |
@@ -766,7 +766,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
766 | { | 766 | { |
767 | if (Body != IntPtr.Zero) | 767 | if (Body != IntPtr.Zero) |
768 | { | 768 | { |
769 | _parent_scene.remActivePrim(this); | 769 | _parent_scene.DeactivatePrim(this); |
770 | m_collisionCategories &= ~CollisionCategories.Body; | 770 | m_collisionCategories &= ~CollisionCategories.Body; |
771 | m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land); | 771 | m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land); |
772 | 772 | ||
@@ -783,7 +783,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
783 | { | 783 | { |
784 | foreach (OdePrim prm in childrenPrim) | 784 | foreach (OdePrim prm in childrenPrim) |
785 | { | 785 | { |
786 | _parent_scene.remActivePrim(prm); | 786 | _parent_scene.DeactivatePrim(prm); |
787 | prm.Body = IntPtr.Zero; | 787 | prm.Body = IntPtr.Zero; |
788 | } | 788 | } |
789 | } | 789 | } |
@@ -793,7 +793,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
793 | } | 793 | } |
794 | else | 794 | else |
795 | { | 795 | { |
796 | _parent_scene.remActivePrim(this); | 796 | _parent_scene.DeactivatePrim(this); |
797 | 797 | ||
798 | m_collisionCategories &= ~CollisionCategories.Body; | 798 | m_collisionCategories &= ~CollisionCategories.Body; |
799 | m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land); | 799 | m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land); |
@@ -814,7 +814,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
814 | 814 | ||
815 | private static Dictionary<IMesh, IntPtr> m_MeshToTriMeshMap = new Dictionary<IMesh, IntPtr>(); | 815 | private static Dictionary<IMesh, IntPtr> m_MeshToTriMeshMap = new Dictionary<IMesh, IntPtr>(); |
816 | 816 | ||
817 | public void setMesh(OdeScene parent_scene, IMesh mesh) | 817 | private void setMesh(OdeScene parent_scene, IMesh mesh) |
818 | { | 818 | { |
819 | // m_log.DebugFormat("[ODE PRIM]: Setting mesh on {0} to {1}", Name, mesh); | 819 | // m_log.DebugFormat("[ODE PRIM]: Setting mesh on {0} to {1}", Name, mesh); |
820 | 820 | ||
@@ -884,73 +884,73 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
884 | // } | 884 | // } |
885 | } | 885 | } |
886 | 886 | ||
887 | public void ProcessTaints(float timestep) | 887 | internal void ProcessTaints() |
888 | { | 888 | { |
889 | #if SPAM | 889 | #if SPAM |
890 | Console.WriteLine("ZProcessTaints for " + Name); | 890 | Console.WriteLine("ZProcessTaints for " + Name); |
891 | #endif | 891 | #endif |
892 | if (m_taintadd) | 892 | if (m_taintadd) |
893 | { | 893 | { |
894 | changeadd(timestep); | 894 | changeadd(); |
895 | } | 895 | } |
896 | 896 | ||
897 | if (prim_geom != IntPtr.Zero) | 897 | if (prim_geom != IntPtr.Zero) |
898 | { | 898 | { |
899 | if (!_position.ApproxEquals(m_taintposition, 0f)) | 899 | if (!_position.ApproxEquals(m_taintposition, 0f)) |
900 | changemove(timestep); | 900 | changemove(); |
901 | 901 | ||
902 | if (m_taintrot != _orientation) | 902 | if (m_taintrot != _orientation) |
903 | { | 903 | { |
904 | if (childPrim && IsPhysical) // For physical child prim... | 904 | if (childPrim && IsPhysical) // For physical child prim... |
905 | { | 905 | { |
906 | rotate(timestep); | 906 | rotate(); |
907 | // KF: ODE will also rotate the parent prim! | 907 | // KF: ODE will also rotate the parent prim! |
908 | // so rotate the root back to where it was | 908 | // so rotate the root back to where it was |
909 | OdePrim parent = (OdePrim)_parent; | 909 | OdePrim parent = (OdePrim)_parent; |
910 | parent.rotate(timestep); | 910 | parent.rotate(); |
911 | } | 911 | } |
912 | else | 912 | else |
913 | { | 913 | { |
914 | //Just rotate the prim | 914 | //Just rotate the prim |
915 | rotate(timestep); | 915 | rotate(); |
916 | } | 916 | } |
917 | } | 917 | } |
918 | 918 | ||
919 | if (m_taintPhysics != IsPhysical && !(m_taintparent != _parent)) | 919 | if (m_taintPhysics != IsPhysical && !(m_taintparent != _parent)) |
920 | changePhysicsStatus(timestep); | 920 | changePhysicsStatus(); |
921 | 921 | ||
922 | if (!_size.ApproxEquals(m_taintsize, 0f)) | 922 | if (!_size.ApproxEquals(m_taintsize, 0f)) |
923 | changesize(timestep); | 923 | changesize(); |
924 | 924 | ||
925 | if (m_taintshape) | 925 | if (m_taintshape) |
926 | changeshape(timestep); | 926 | changeshape(); |
927 | 927 | ||
928 | if (m_taintforce) | 928 | if (m_taintforce) |
929 | changeAddForce(timestep); | 929 | changeAddForce(); |
930 | 930 | ||
931 | if (m_taintaddangularforce) | 931 | if (m_taintaddangularforce) |
932 | changeAddAngularForce(timestep); | 932 | changeAddAngularForce(); |
933 | 933 | ||
934 | if (!m_taintTorque.ApproxEquals(Vector3.Zero, 0.001f)) | 934 | if (!m_taintTorque.ApproxEquals(Vector3.Zero, 0.001f)) |
935 | changeSetTorque(timestep); | 935 | changeSetTorque(); |
936 | 936 | ||
937 | if (m_taintdisable) | 937 | if (m_taintdisable) |
938 | changedisable(timestep); | 938 | changedisable(); |
939 | 939 | ||
940 | if (m_taintselected != m_isSelected) | 940 | if (m_taintselected != m_isSelected) |
941 | changeSelectedStatus(timestep); | 941 | changeSelectedStatus(); |
942 | 942 | ||
943 | if (!m_taintVelocity.ApproxEquals(Vector3.Zero, 0.001f)) | 943 | if (!m_taintVelocity.ApproxEquals(Vector3.Zero, 0.001f)) |
944 | changevelocity(timestep); | 944 | changevelocity(); |
945 | 945 | ||
946 | if (m_taintparent != _parent) | 946 | if (m_taintparent != _parent) |
947 | changelink(timestep); | 947 | changelink(); |
948 | 948 | ||
949 | if (m_taintCollidesWater != m_collidesWater) | 949 | if (m_taintCollidesWater != m_collidesWater) |
950 | changefloatonwater(timestep); | 950 | changefloatonwater(); |
951 | 951 | ||
952 | if (!m_angularlock.ApproxEquals(m_taintAngularLock,0f)) | 952 | if (!m_angularlock.ApproxEquals(m_taintAngularLock,0f)) |
953 | changeAngularLock(timestep); | 953 | changeAngularLock(); |
954 | } | 954 | } |
955 | else | 955 | else |
956 | { | 956 | { |
@@ -958,7 +958,10 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
958 | } | 958 | } |
959 | } | 959 | } |
960 | 960 | ||
961 | private void changeAngularLock(float timestep) | 961 | /// <summary> |
962 | /// Change prim in response to an angular lock taint. | ||
963 | /// </summary> | ||
964 | private void changeAngularLock() | ||
962 | { | 965 | { |
963 | // do we have a Physical object? | 966 | // do we have a Physical object? |
964 | if (Body != IntPtr.Zero) | 967 | if (Body != IntPtr.Zero) |
@@ -983,11 +986,15 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
983 | } | 986 | } |
984 | } | 987 | } |
985 | } | 988 | } |
989 | |||
986 | // Store this for later in case we get turned into a separate body | 990 | // Store this for later in case we get turned into a separate body |
987 | m_angularlock = m_taintAngularLock; | 991 | m_angularlock = m_taintAngularLock; |
988 | } | 992 | } |
989 | 993 | ||
990 | private void changelink(float timestep) | 994 | /// <summary> |
995 | /// Change prim in response to a link taint. | ||
996 | /// </summary> | ||
997 | private void changelink() | ||
991 | { | 998 | { |
992 | // If the newly set parent is not null | 999 | // If the newly set parent is not null |
993 | // create link | 1000 | // create link |
@@ -1042,7 +1049,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1042 | /// Add a child prim to this parent prim. | 1049 | /// Add a child prim to this parent prim. |
1043 | /// </summary> | 1050 | /// </summary> |
1044 | /// <param name="prim">Child prim</param> | 1051 | /// <param name="prim">Child prim</param> |
1045 | public void AddChildPrim(OdePrim prim) | 1052 | private void AddChildPrim(OdePrim prim) |
1046 | { | 1053 | { |
1047 | //Console.WriteLine("AddChildPrim " + Name); | 1054 | //Console.WriteLine("AddChildPrim " + Name); |
1048 | if (this.m_localID != prim.m_localID) | 1055 | if (this.m_localID != prim.m_localID) |
@@ -1134,7 +1141,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1134 | prm.createAMotor(m_angularlock); | 1141 | prm.createAMotor(m_angularlock); |
1135 | } | 1142 | } |
1136 | prm.Body = Body; | 1143 | prm.Body = Body; |
1137 | _parent_scene.addActivePrim(prm); | 1144 | _parent_scene.ActivatePrim(prm); |
1138 | } | 1145 | } |
1139 | 1146 | ||
1140 | m_collisionCategories |= CollisionCategories.Body; | 1147 | m_collisionCategories |= CollisionCategories.Body; |
@@ -1179,7 +1186,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1179 | if (m_vehicle.Type != Vehicle.TYPE_NONE) | 1186 | if (m_vehicle.Type != Vehicle.TYPE_NONE) |
1180 | m_vehicle.Enable(Body, _parent_scene); | 1187 | m_vehicle.Enable(Body, _parent_scene); |
1181 | 1188 | ||
1182 | _parent_scene.addActivePrim(this); | 1189 | _parent_scene.ActivatePrim(this); |
1183 | } | 1190 | } |
1184 | } | 1191 | } |
1185 | } | 1192 | } |
@@ -1206,7 +1213,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1206 | 1213 | ||
1207 | if (Body != IntPtr.Zero) | 1214 | if (Body != IntPtr.Zero) |
1208 | { | 1215 | { |
1209 | _parent_scene.remActivePrim(this); | 1216 | _parent_scene.DeactivatePrim(this); |
1210 | } | 1217 | } |
1211 | 1218 | ||
1212 | lock (childrenPrim) | 1219 | lock (childrenPrim) |
@@ -1245,7 +1252,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1245 | 1252 | ||
1246 | if (Body != IntPtr.Zero) | 1253 | if (Body != IntPtr.Zero) |
1247 | { | 1254 | { |
1248 | _parent_scene.remActivePrim(this); | 1255 | _parent_scene.DeactivatePrim(this); |
1249 | } | 1256 | } |
1250 | 1257 | ||
1251 | lock (childrenPrim) | 1258 | lock (childrenPrim) |
@@ -1258,7 +1265,10 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1258 | } | 1265 | } |
1259 | } | 1266 | } |
1260 | 1267 | ||
1261 | private void changeSelectedStatus(float timestep) | 1268 | /// <summary> |
1269 | /// Change prim in response to a selection taint. | ||
1270 | /// </summary> | ||
1271 | private void changeSelectedStatus() | ||
1262 | { | 1272 | { |
1263 | if (m_taintselected) | 1273 | if (m_taintselected) |
1264 | { | 1274 | { |
@@ -1338,7 +1348,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1338 | m_isSelected = m_taintselected; | 1348 | m_isSelected = m_taintselected; |
1339 | }//end changeSelectedStatus | 1349 | }//end changeSelectedStatus |
1340 | 1350 | ||
1341 | public void ResetTaints() | 1351 | internal void ResetTaints() |
1342 | { | 1352 | { |
1343 | m_taintposition = _position; | 1353 | m_taintposition = _position; |
1344 | m_taintrot = _orientation; | 1354 | m_taintrot = _orientation; |
@@ -1356,7 +1366,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1356 | /// </summary> | 1366 | /// </summary> |
1357 | /// <param name="m_targetSpace"></param> | 1367 | /// <param name="m_targetSpace"></param> |
1358 | /// <param name="mesh">If null, then a mesh is used that is based on the profile shape data.</param> | 1368 | /// <param name="mesh">If null, then a mesh is used that is based on the profile shape data.</param> |
1359 | public void CreateGeom(IntPtr m_targetSpace, IMesh mesh) | 1369 | private void CreateGeom(IntPtr m_targetSpace, IMesh mesh) |
1360 | { | 1370 | { |
1361 | #if SPAM | 1371 | #if SPAM |
1362 | Console.WriteLine("CreateGeom:"); | 1372 | Console.WriteLine("CreateGeom:"); |
@@ -1442,7 +1452,7 @@ Console.WriteLine("CreateGeom:"); | |||
1442 | /// <param name="m_targetSpace"></param> | 1452 | /// <param name="m_targetSpace"></param> |
1443 | /// <param name="mesh">If null, then a mesh is used that is based on the profile shape data.</param> | 1453 | /// <param name="mesh">If null, then a mesh is used that is based on the profile shape data.</param> |
1444 | /// <returns>true if the geom was successfully removed, false if it was already gone or the remove failed.</returns> | 1454 | /// <returns>true if the geom was successfully removed, false if it was already gone or the remove failed.</returns> |
1445 | public bool RemoveGeom() | 1455 | internal bool RemoveGeom() |
1446 | { | 1456 | { |
1447 | if (prim_geom != IntPtr.Zero) | 1457 | if (prim_geom != IntPtr.Zero) |
1448 | { | 1458 | { |
@@ -1468,8 +1478,10 @@ Console.WriteLine("CreateGeom:"); | |||
1468 | return false; | 1478 | return false; |
1469 | } | 1479 | } |
1470 | } | 1480 | } |
1471 | 1481 | /// <summary> | |
1472 | public void changeadd(float timestep) | 1482 | /// Add prim in response to an add taint. |
1483 | /// </summary> | ||
1484 | private void changeadd() | ||
1473 | { | 1485 | { |
1474 | int[] iprimspaceArrItem = _parent_scene.calculateSpaceArrayItemFromPos(_position); | 1486 | int[] iprimspaceArrItem = _parent_scene.calculateSpaceArrayItemFromPos(_position); |
1475 | IntPtr targetspace = _parent_scene.calculateSpaceForGeom(_position); | 1487 | IntPtr targetspace = _parent_scene.calculateSpaceForGeom(_position); |
@@ -1513,12 +1525,15 @@ Console.WriteLine("changeadd 1"); | |||
1513 | } | 1525 | } |
1514 | } | 1526 | } |
1515 | 1527 | ||
1516 | changeSelectedStatus(timestep); | 1528 | changeSelectedStatus(); |
1517 | 1529 | ||
1518 | m_taintadd = false; | 1530 | m_taintadd = false; |
1519 | } | 1531 | } |
1520 | 1532 | ||
1521 | public void changemove(float timestep) | 1533 | /// <summary> |
1534 | /// Move prim in response to a move taint. | ||
1535 | /// </summary> | ||
1536 | private void changemove() | ||
1522 | { | 1537 | { |
1523 | if (IsPhysical) | 1538 | if (IsPhysical) |
1524 | { | 1539 | { |
@@ -1589,13 +1604,13 @@ Console.WriteLine(" JointCreateFixed"); | |||
1589 | } | 1604 | } |
1590 | } | 1605 | } |
1591 | 1606 | ||
1592 | changeSelectedStatus(timestep); | 1607 | changeSelectedStatus(); |
1593 | 1608 | ||
1594 | resetCollisionAccounting(); | 1609 | resetCollisionAccounting(); |
1595 | m_taintposition = _position; | 1610 | m_taintposition = _position; |
1596 | } | 1611 | } |
1597 | 1612 | ||
1598 | public void Move(float timestep) | 1613 | internal void Move(float timestep) |
1599 | { | 1614 | { |
1600 | float fx = 0; | 1615 | float fx = 0; |
1601 | float fy = 0; | 1616 | float fy = 0; |
@@ -1842,7 +1857,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1842 | } | 1857 | } |
1843 | } | 1858 | } |
1844 | 1859 | ||
1845 | public void rotate(float timestep) | 1860 | private void rotate() |
1846 | { | 1861 | { |
1847 | d.Quaternion myrot = new d.Quaternion(); | 1862 | d.Quaternion myrot = new d.Quaternion(); |
1848 | myrot.X = _orientation.X; | 1863 | myrot.X = _orientation.X; |
@@ -1876,7 +1891,10 @@ Console.WriteLine(" JointCreateFixed"); | |||
1876 | m_disabled = false; | 1891 | m_disabled = false; |
1877 | } | 1892 | } |
1878 | 1893 | ||
1879 | public void changedisable(float timestep) | 1894 | /// <summary> |
1895 | /// Change prim in response to a disable taint. | ||
1896 | /// </summary> | ||
1897 | private void changedisable() | ||
1880 | { | 1898 | { |
1881 | m_disabled = true; | 1899 | m_disabled = true; |
1882 | if (Body != IntPtr.Zero) | 1900 | if (Body != IntPtr.Zero) |
@@ -1888,7 +1906,10 @@ Console.WriteLine(" JointCreateFixed"); | |||
1888 | m_taintdisable = false; | 1906 | m_taintdisable = false; |
1889 | } | 1907 | } |
1890 | 1908 | ||
1891 | public void changePhysicsStatus(float timestep) | 1909 | /// <summary> |
1910 | /// Change prim in response to a physics status taint | ||
1911 | /// </summary> | ||
1912 | private void changePhysicsStatus() | ||
1892 | { | 1913 | { |
1893 | if (IsPhysical) | 1914 | if (IsPhysical) |
1894 | { | 1915 | { |
@@ -1896,7 +1917,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1896 | { | 1917 | { |
1897 | if (_pbs.SculptEntry && _parent_scene.meshSculptedPrim) | 1918 | if (_pbs.SculptEntry && _parent_scene.meshSculptedPrim) |
1898 | { | 1919 | { |
1899 | changeshape(2f); | 1920 | changeshape(); |
1900 | } | 1921 | } |
1901 | else | 1922 | else |
1902 | { | 1923 | { |
@@ -1913,7 +1934,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1913 | RemoveGeom(); | 1934 | RemoveGeom(); |
1914 | 1935 | ||
1915 | //Console.WriteLine("changePhysicsStatus for " + Name); | 1936 | //Console.WriteLine("changePhysicsStatus for " + Name); |
1916 | changeadd(2f); | 1937 | changeadd(); |
1917 | } | 1938 | } |
1918 | 1939 | ||
1919 | if (childPrim) | 1940 | if (childPrim) |
@@ -1931,13 +1952,16 @@ Console.WriteLine(" JointCreateFixed"); | |||
1931 | } | 1952 | } |
1932 | } | 1953 | } |
1933 | 1954 | ||
1934 | changeSelectedStatus(timestep); | 1955 | changeSelectedStatus(); |
1935 | 1956 | ||
1936 | resetCollisionAccounting(); | 1957 | resetCollisionAccounting(); |
1937 | m_taintPhysics = IsPhysical; | 1958 | m_taintPhysics = IsPhysical; |
1938 | } | 1959 | } |
1939 | 1960 | ||
1940 | public void changesize(float timestamp) | 1961 | /// <summary> |
1962 | /// Change prim in response to a size taint. | ||
1963 | /// </summary> | ||
1964 | private void changesize() | ||
1941 | { | 1965 | { |
1942 | #if SPAM | 1966 | #if SPAM |
1943 | m_log.DebugFormat("[ODE PRIM]: Called changesize"); | 1967 | m_log.DebugFormat("[ODE PRIM]: Called changesize"); |
@@ -2007,7 +2031,8 @@ Console.WriteLine(" JointCreateFixed"); | |||
2007 | d.BodyEnable(Body); | 2031 | d.BodyEnable(Body); |
2008 | } | 2032 | } |
2009 | 2033 | ||
2010 | changeSelectedStatus(timestamp); | 2034 | changeSelectedStatus(); |
2035 | |||
2011 | if (childPrim) | 2036 | if (childPrim) |
2012 | { | 2037 | { |
2013 | if (_parent is OdePrim) | 2038 | if (_parent is OdePrim) |
@@ -2020,7 +2045,11 @@ Console.WriteLine(" JointCreateFixed"); | |||
2020 | m_taintsize = _size; | 2045 | m_taintsize = _size; |
2021 | } | 2046 | } |
2022 | 2047 | ||
2023 | public void changefloatonwater(float timestep) | 2048 | /// <summary> |
2049 | /// Change prim in response to a float on water taint. | ||
2050 | /// </summary> | ||
2051 | /// <param name="timestep"></param> | ||
2052 | private void changefloatonwater() | ||
2024 | { | 2053 | { |
2025 | m_collidesWater = m_taintCollidesWater; | 2054 | m_collidesWater = m_taintCollidesWater; |
2026 | 2055 | ||
@@ -2038,7 +2067,10 @@ Console.WriteLine(" JointCreateFixed"); | |||
2038 | } | 2067 | } |
2039 | } | 2068 | } |
2040 | 2069 | ||
2041 | public void changeshape(float timestamp) | 2070 | /// <summary> |
2071 | /// Change prim in response to a shape taint. | ||
2072 | /// </summary> | ||
2073 | private void changeshape() | ||
2042 | { | 2074 | { |
2043 | // Cleanup of old prim geometry and Bodies | 2075 | // Cleanup of old prim geometry and Bodies |
2044 | if (IsPhysical && Body != IntPtr.Zero) | 2076 | if (IsPhysical && Body != IntPtr.Zero) |
@@ -2101,7 +2133,8 @@ Console.WriteLine(" JointCreateFixed"); | |||
2101 | } | 2133 | } |
2102 | } | 2134 | } |
2103 | 2135 | ||
2104 | changeSelectedStatus(timestamp); | 2136 | changeSelectedStatus(); |
2137 | |||
2105 | if (childPrim) | 2138 | if (childPrim) |
2106 | { | 2139 | { |
2107 | if (_parent is OdePrim) | 2140 | if (_parent is OdePrim) |
@@ -2115,7 +2148,10 @@ Console.WriteLine(" JointCreateFixed"); | |||
2115 | m_taintshape = false; | 2148 | m_taintshape = false; |
2116 | } | 2149 | } |
2117 | 2150 | ||
2118 | public void changeAddForce(float timestamp) | 2151 | /// <summary> |
2152 | /// Change prim in response to an add force taint. | ||
2153 | /// </summary> | ||
2154 | private void changeAddForce() | ||
2119 | { | 2155 | { |
2120 | if (!m_isSelected) | 2156 | if (!m_isSelected) |
2121 | { | 2157 | { |
@@ -2163,7 +2199,10 @@ Console.WriteLine(" JointCreateFixed"); | |||
2163 | m_taintforce = false; | 2199 | m_taintforce = false; |
2164 | } | 2200 | } |
2165 | 2201 | ||
2166 | public void changeSetTorque(float timestamp) | 2202 | /// <summary> |
2203 | /// Change prim in response to a torque taint. | ||
2204 | /// </summary> | ||
2205 | private void changeSetTorque() | ||
2167 | { | 2206 | { |
2168 | if (!m_isSelected) | 2207 | if (!m_isSelected) |
2169 | { | 2208 | { |
@@ -2176,7 +2215,10 @@ Console.WriteLine(" JointCreateFixed"); | |||
2176 | m_taintTorque = Vector3.Zero; | 2215 | m_taintTorque = Vector3.Zero; |
2177 | } | 2216 | } |
2178 | 2217 | ||
2179 | public void changeAddAngularForce(float timestamp) | 2218 | /// <summary> |
2219 | /// Change prim in response to an angular force taint. | ||
2220 | /// </summary> | ||
2221 | private void changeAddAngularForce() | ||
2180 | { | 2222 | { |
2181 | if (!m_isSelected) | 2223 | if (!m_isSelected) |
2182 | { | 2224 | { |
@@ -2204,7 +2246,10 @@ Console.WriteLine(" JointCreateFixed"); | |||
2204 | m_taintaddangularforce = false; | 2246 | m_taintaddangularforce = false; |
2205 | } | 2247 | } |
2206 | 2248 | ||
2207 | private void changevelocity(float timestep) | 2249 | /// <summary> |
2250 | /// Change prim in response to a velocity taint. | ||
2251 | /// </summary> | ||
2252 | private void changevelocity() | ||
2208 | { | 2253 | { |
2209 | if (!m_isSelected) | 2254 | if (!m_isSelected) |
2210 | { | 2255 | { |
@@ -2219,10 +2264,11 @@ Console.WriteLine(" JointCreateFixed"); | |||
2219 | 2264 | ||
2220 | //resetCollisionAccounting(); | 2265 | //resetCollisionAccounting(); |
2221 | } | 2266 | } |
2267 | |||
2222 | m_taintVelocity = Vector3.Zero; | 2268 | m_taintVelocity = Vector3.Zero; |
2223 | } | 2269 | } |
2224 | 2270 | ||
2225 | public void setPrimForRemoval() | 2271 | internal void setPrimForRemoval() |
2226 | { | 2272 | { |
2227 | m_taintremove = true; | 2273 | m_taintremove = true; |
2228 | } | 2274 | } |
@@ -2438,16 +2484,13 @@ Console.WriteLine(" JointCreateFixed"); | |||
2438 | set | 2484 | set |
2439 | { | 2485 | { |
2440 | if (QuaternionIsFinite(value)) | 2486 | if (QuaternionIsFinite(value)) |
2441 | { | ||
2442 | _orientation = value; | 2487 | _orientation = value; |
2443 | } | ||
2444 | else | 2488 | else |
2445 | m_log.WarnFormat("[PHYSICS]: Got NaN quaternion Orientation from Scene in Object {0}", Name); | 2489 | m_log.WarnFormat("[PHYSICS]: Got NaN quaternion Orientation from Scene in Object {0}", Name); |
2446 | |||
2447 | } | 2490 | } |
2448 | } | 2491 | } |
2449 | 2492 | ||
2450 | internal static bool QuaternionIsFinite(Quaternion q) | 2493 | private static bool QuaternionIsFinite(Quaternion q) |
2451 | { | 2494 | { |
2452 | if (Single.IsNaN(q.X) || Single.IsInfinity(q.X)) | 2495 | if (Single.IsNaN(q.X) || Single.IsInfinity(q.X)) |
2453 | return false; | 2496 | return false; |
@@ -2465,12 +2508,6 @@ Console.WriteLine(" JointCreateFixed"); | |||
2465 | get { return _acceleration; } | 2508 | get { return _acceleration; } |
2466 | } | 2509 | } |
2467 | 2510 | ||
2468 | |||
2469 | public void SetAcceleration(Vector3 accel) | ||
2470 | { | ||
2471 | _acceleration = accel; | ||
2472 | } | ||
2473 | |||
2474 | public override void AddForce(Vector3 force, bool pushforce) | 2511 | public override void AddForce(Vector3 force, bool pushforce) |
2475 | { | 2512 | { |
2476 | if (force.IsFinite()) | 2513 | if (force.IsFinite()) |
@@ -2574,7 +2611,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2574 | } | 2611 | } |
2575 | } | 2612 | } |
2576 | 2613 | ||
2577 | public void UpdatePositionAndVelocity() | 2614 | internal void UpdatePositionAndVelocity() |
2578 | { | 2615 | { |
2579 | // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! | 2616 | // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! |
2580 | if (_parent == null) | 2617 | if (_parent == null) |
@@ -2943,7 +2980,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2943 | d.JointSetAMotorParam(Amotor, (int)dParam.FMax, Mass * 50f);// | 2980 | d.JointSetAMotorParam(Amotor, (int)dParam.FMax, Mass * 50f);// |
2944 | } | 2981 | } |
2945 | 2982 | ||
2946 | public Matrix4 FromDMass(d.Mass pMass) | 2983 | private Matrix4 FromDMass(d.Mass pMass) |
2947 | { | 2984 | { |
2948 | Matrix4 obj; | 2985 | Matrix4 obj; |
2949 | obj.M11 = pMass.I.M00; | 2986 | obj.M11 = pMass.I.M00; |
@@ -2965,7 +3002,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2965 | return obj; | 3002 | return obj; |
2966 | } | 3003 | } |
2967 | 3004 | ||
2968 | public d.Mass FromMatrix4(Matrix4 pMat, ref d.Mass obj) | 3005 | private d.Mass FromMatrix4(Matrix4 pMat, ref d.Mass obj) |
2969 | { | 3006 | { |
2970 | obj.I.M00 = pMat[0, 0]; | 3007 | obj.I.M00 = pMat[0, 0]; |
2971 | obj.I.M01 = pMat[0, 1]; | 3008 | obj.I.M01 = pMat[0, 1]; |
@@ -3153,6 +3190,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
3153 | break; | 3190 | break; |
3154 | } | 3191 | } |
3155 | } | 3192 | } |
3193 | |||
3156 | private static float determinant3x3(Matrix4 pMat) | 3194 | private static float determinant3x3(Matrix4 pMat) |
3157 | { | 3195 | { |
3158 | float det = 0; | 3196 | float det = 0; |
@@ -3190,4 +3228,4 @@ Console.WriteLine(" JointCreateFixed"); | |||
3190 | m_material = pMaterial; | 3228 | m_material = pMaterial; |
3191 | } | 3229 | } |
3192 | } | 3230 | } |
3193 | } | 3231 | } \ No newline at end of file |