diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs b/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs index 36546aa..8934330 100644 --- a/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs | |||
@@ -33,7 +33,7 @@ | |||
33 | * ODEDynamics.cs contains methods dealing with Prim Physical motion | 33 | * ODEDynamics.cs contains methods dealing with Prim Physical motion |
34 | * (dynamics) and the associated settings. Old Linear and angular | 34 | * (dynamics) and the associated settings. Old Linear and angular |
35 | * motors for dynamic motion have been replace with MoveLinear() | 35 | * motors for dynamic motion have been replace with MoveLinear() |
36 | * and MoveAngular(); 'Physical' is used only to switch ODE dynamic | 36 | * and MoveAngular(); 'Physical' is used only to switch ODE dynamic |
37 | * simualtion on/off; VEHICAL_TYPE_NONE/VEHICAL_TYPE_<other> is to | 37 | * simualtion on/off; VEHICAL_TYPE_NONE/VEHICAL_TYPE_<other> is to |
38 | * switch between 'VEHICLE' parameter use and general dynamics | 38 | * switch between 'VEHICLE' parameter use and general dynamics |
39 | * settings use. | 39 | * settings use. |
@@ -133,7 +133,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
133 | private float m_targetHoverHeight; | 133 | private float m_targetHoverHeight; |
134 | private float m_groundHeight; | 134 | private float m_groundHeight; |
135 | private float m_waterHeight; | 135 | private float m_waterHeight; |
136 | private float m_buoyancy; //KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle. | 136 | private float m_buoyancy; //KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle. |
137 | 137 | ||
138 | // private float m_tensor = 5f; | 138 | // private float m_tensor = 5f; |
139 | private int body_autodisable_frames = 20; | 139 | private int body_autodisable_frames = 20; |
@@ -170,7 +170,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
170 | 170 | ||
171 | private PrimitiveBaseShape _pbs; | 171 | private PrimitiveBaseShape _pbs; |
172 | private OdeScene _parent_scene; | 172 | private OdeScene _parent_scene; |
173 | 173 | ||
174 | /// <summary> | 174 | /// <summary> |
175 | /// The physics space which contains prim geometries | 175 | /// The physics space which contains prim geometries |
176 | /// </summary> | 176 | /// </summary> |
@@ -443,7 +443,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
443 | 443 | ||
444 | d.BodySetAutoDisableFlag(Body, true); | 444 | d.BodySetAutoDisableFlag(Body, true); |
445 | d.BodySetAutoDisableSteps(Body, body_autodisable_frames); | 445 | d.BodySetAutoDisableSteps(Body, body_autodisable_frames); |
446 | 446 | ||
447 | // disconnect from world gravity so we can apply buoyancy | 447 | // disconnect from world gravity so we can apply buoyancy |
448 | d.BodySetGravityMode (Body, false); | 448 | d.BodySetGravityMode (Body, false); |
449 | 449 | ||
@@ -474,8 +474,8 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
474 | 474 | ||
475 | float returnMass = 0; | 475 | float returnMass = 0; |
476 | float hollowAmount = (float)_pbs.ProfileHollow * 2.0e-5f; | 476 | float hollowAmount = (float)_pbs.ProfileHollow * 2.0e-5f; |
477 | float hollowVolume = hollowAmount * hollowAmount; | 477 | float hollowVolume = hollowAmount * hollowAmount; |
478 | 478 | ||
479 | switch (_pbs.ProfileShape) | 479 | switch (_pbs.ProfileShape) |
480 | { | 480 | { |
481 | case ProfileShape.Square: | 481 | case ProfileShape.Square: |
@@ -511,16 +511,16 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
511 | 511 | ||
512 | else if (_pbs.PathCurve == (byte)Extrusion.Curve1) | 512 | else if (_pbs.PathCurve == (byte)Extrusion.Curve1) |
513 | { | 513 | { |
514 | //a tube | 514 | //a tube |
515 | 515 | ||
516 | volume *= 0.78539816339e-2f * (float)(200 - _pbs.PathScaleX); | 516 | volume *= 0.78539816339e-2f * (float)(200 - _pbs.PathScaleX); |
517 | tmp= 1.0f -2.0e-2f * (float)(200 - _pbs.PathScaleY); | 517 | tmp= 1.0f -2.0e-2f * (float)(200 - _pbs.PathScaleY); |
518 | volume -= volume*tmp*tmp; | 518 | volume -= volume*tmp*tmp; |
519 | 519 | ||
520 | if (hollowAmount > 0.0) | 520 | if (hollowAmount > 0.0) |
521 | { | 521 | { |
522 | hollowVolume *= hollowAmount; | 522 | hollowVolume *= hollowAmount; |
523 | 523 | ||
524 | switch (_pbs.HollowShape) | 524 | switch (_pbs.HollowShape) |
525 | { | 525 | { |
526 | case HollowShape.Square: | 526 | case HollowShape.Square: |
@@ -579,7 +579,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
579 | volume *= 0.61685027506808491367715568749226e-2f * (float)(200 - _pbs.PathScaleX); | 579 | volume *= 0.61685027506808491367715568749226e-2f * (float)(200 - _pbs.PathScaleX); |
580 | tmp = 1.0f - .02f * (float)(200 - _pbs.PathScaleY); | 580 | tmp = 1.0f - .02f * (float)(200 - _pbs.PathScaleY); |
581 | volume *= (1.0f - tmp * tmp); | 581 | volume *= (1.0f - tmp * tmp); |
582 | 582 | ||
583 | if (hollowAmount > 0.0) | 583 | if (hollowAmount > 0.0) |
584 | { | 584 | { |
585 | 585 | ||
@@ -845,7 +845,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
845 | else | 845 | else |
846 | { | 846 | { |
847 | _parent_scene.DeactivatePrim(this); | 847 | _parent_scene.DeactivatePrim(this); |
848 | 848 | ||
849 | m_collisionCategories &= ~CollisionCategories.Body; | 849 | m_collisionCategories &= ~CollisionCategories.Body; |
850 | m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land); | 850 | m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land); |
851 | 851 | ||
@@ -916,7 +916,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
916 | else | 916 | else |
917 | { | 917 | { |
918 | _triMeshData = d.GeomTriMeshDataCreate(); | 918 | _triMeshData = d.GeomTriMeshDataCreate(); |
919 | 919 | ||
920 | d.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride); | 920 | d.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride); |
921 | d.GeomTriMeshDataPreprocess(_triMeshData); | 921 | d.GeomTriMeshDataPreprocess(_triMeshData); |
922 | m_MeshToTriMeshMap[mesh] = _triMeshData; | 922 | m_MeshToTriMeshMap[mesh] = _triMeshData; |
@@ -974,7 +974,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
974 | rotate(); | 974 | rotate(); |
975 | } | 975 | } |
976 | } | 976 | } |
977 | 977 | ||
978 | if (m_taintPhysics != IsPhysical && !(m_taintparent != _parent)) | 978 | if (m_taintPhysics != IsPhysical && !(m_taintparent != _parent)) |
979 | changePhysicsStatus(); | 979 | changePhysicsStatus(); |
980 | 980 | ||
@@ -1074,7 +1074,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1074 | else if (_parent != null && m_taintparent == null) | 1074 | else if (_parent != null && m_taintparent == null) |
1075 | { | 1075 | { |
1076 | //Console.WriteLine(" changelink B"); | 1076 | //Console.WriteLine(" changelink B"); |
1077 | 1077 | ||
1078 | if (_parent is OdePrim) | 1078 | if (_parent is OdePrim) |
1079 | { | 1079 | { |
1080 | OdePrim obj = (OdePrim)_parent; | 1080 | OdePrim obj = (OdePrim)_parent; |
@@ -1082,16 +1082,16 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1082 | childPrim = false; | 1082 | childPrim = false; |
1083 | //_parent = null; | 1083 | //_parent = null; |
1084 | } | 1084 | } |
1085 | 1085 | ||
1086 | /* | 1086 | /* |
1087 | if (Body != (IntPtr)0 && _linkJointGroup != (IntPtr)0) | 1087 | if (Body != (IntPtr)0 && _linkJointGroup != (IntPtr)0) |
1088 | d.JointGroupDestroy(_linkJointGroup); | 1088 | d.JointGroupDestroy(_linkJointGroup); |
1089 | 1089 | ||
1090 | _linkJointGroup = (IntPtr)0; | 1090 | _linkJointGroup = (IntPtr)0; |
1091 | m_linkJoint = (IntPtr)0; | 1091 | m_linkJoint = (IntPtr)0; |
1092 | */ | 1092 | */ |
1093 | } | 1093 | } |
1094 | 1094 | ||
1095 | _parent = m_taintparent; | 1095 | _parent = m_taintparent; |
1096 | m_taintPhysics = IsPhysical; | 1096 | m_taintPhysics = IsPhysical; |
1097 | } | 1097 | } |
@@ -1345,7 +1345,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1345 | // in between the disabling and the collision properties setting | 1345 | // in between the disabling and the collision properties setting |
1346 | // which would wake the physical body up from a soft disabling and potentially cause it to fall | 1346 | // which would wake the physical body up from a soft disabling and potentially cause it to fall |
1347 | // through the ground. | 1347 | // through the ground. |
1348 | 1348 | ||
1349 | // NOTE FOR JOINTS: this doesn't always work for jointed assemblies because if you select | 1349 | // NOTE FOR JOINTS: this doesn't always work for jointed assemblies because if you select |
1350 | // just one part of the assembly, the rest of the assembly is non-selected and still simulating, | 1350 | // just one part of the assembly, the rest of the assembly is non-selected and still simulating, |
1351 | // so that causes the selected part to wake up and continue moving. | 1351 | // so that causes the selected part to wake up and continue moving. |
@@ -1359,7 +1359,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1359 | // e.g. we select 100 prims that are connected by joints. non-atomically, the first 50 are | 1359 | // e.g. we select 100 prims that are connected by joints. non-atomically, the first 50 are |
1360 | // selected and disabled. then, due to a thread switch, the selection processing is | 1360 | // selected and disabled. then, due to a thread switch, the selection processing is |
1361 | // interrupted and the physics engine continues to simulate, so the last 50 items, whose | 1361 | // interrupted and the physics engine continues to simulate, so the last 50 items, whose |
1362 | // selection was not yet processed, continues to simulate. this wakes up ALL of the | 1362 | // selection was not yet processed, continues to simulate. this wakes up ALL of the |
1363 | // first 50 again. then the last 50 are disabled. then the first 50, which were just woken | 1363 | // first 50 again. then the last 50 are disabled. then the first 50, which were just woken |
1364 | // up, start simulating again, which in turn wakes up the last 50. | 1364 | // up, start simulating again, which in turn wakes up the last 50. |
1365 | 1365 | ||
@@ -1565,7 +1565,7 @@ Console.WriteLine("CreateGeom:"); | |||
1565 | private void changeadd() | 1565 | private void changeadd() |
1566 | { | 1566 | { |
1567 | // m_log.DebugFormat("[ODE PRIM]: Adding prim {0}", Name); | 1567 | // m_log.DebugFormat("[ODE PRIM]: Adding prim {0}", Name); |
1568 | 1568 | ||
1569 | int[] iprimspaceArrItem = _parent_scene.calculateSpaceArrayItemFromPos(_position); | 1569 | int[] iprimspaceArrItem = _parent_scene.calculateSpaceArrayItemFromPos(_position); |
1570 | IntPtr targetspace = _parent_scene.calculateSpaceForGeom(_position); | 1570 | IntPtr targetspace = _parent_scene.calculateSpaceForGeom(_position); |
1571 | 1571 | ||
@@ -1711,10 +1711,10 @@ Console.WriteLine(" JointCreateFixed"); | |||
1711 | // fz = 0f; | 1711 | // fz = 0f; |
1712 | //m_log.Info(m_collisionFlags.ToString()); | 1712 | //m_log.Info(m_collisionFlags.ToString()); |
1713 | 1713 | ||
1714 | 1714 | ||
1715 | //KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle. | 1715 | //KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle. |
1716 | // would come from SceneObjectPart.cs, public void SetBuoyancy(float fvalue) , PhysActor.Buoyancy = fvalue; ?? | 1716 | // would come from SceneObjectPart.cs, public void SetBuoyancy(float fvalue) , PhysActor.Buoyancy = fvalue; ?? |
1717 | // m_buoyancy: (unlimited value) <0=Falls fast; 0=1g; 1=0g; >1 = floats up | 1717 | // m_buoyancy: (unlimited value) <0=Falls fast; 0=1g; 1=0g; >1 = floats up |
1718 | // gravityz multiplier = 1 - m_buoyancy | 1718 | // gravityz multiplier = 1 - m_buoyancy |
1719 | fz = _parent_scene.gravityz * (1.0f - m_buoyancy) * m_mass; | 1719 | fz = _parent_scene.gravityz * (1.0f - m_buoyancy) * m_mass; |
1720 | 1720 | ||
@@ -1729,7 +1729,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1729 | fz = 0f; | 1729 | fz = 0f; |
1730 | 1730 | ||
1731 | // no lock; for now it's only called from within Simulate() | 1731 | // no lock; for now it's only called from within Simulate() |
1732 | 1732 | ||
1733 | // If the PID Controller isn't active then we set our force | 1733 | // If the PID Controller isn't active then we set our force |
1734 | // calculating base velocity to the current position | 1734 | // calculating base velocity to the current position |
1735 | 1735 | ||
@@ -1738,7 +1738,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1738 | //PID_G = PID_G / m_PIDTau; | 1738 | //PID_G = PID_G / m_PIDTau; |
1739 | m_PIDTau = 1; | 1739 | m_PIDTau = 1; |
1740 | } | 1740 | } |
1741 | 1741 | ||
1742 | if ((PID_G - m_PIDTau) <= 0) | 1742 | if ((PID_G - m_PIDTau) <= 0) |
1743 | { | 1743 | { |
1744 | PID_G = m_PIDTau + 1; | 1744 | PID_G = m_PIDTau + 1; |
@@ -1761,7 +1761,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1761 | if (_target_velocity.ApproxEquals(Vector3.Zero,0.1f)) | 1761 | if (_target_velocity.ApproxEquals(Vector3.Zero,0.1f)) |
1762 | { | 1762 | { |
1763 | // keep track of where we stopped. No more slippin' & slidin' | 1763 | // keep track of where we stopped. No more slippin' & slidin' |
1764 | 1764 | ||
1765 | // We only want to deactivate the PID Controller if we think we want to have our surrogate | 1765 | // We only want to deactivate the PID Controller if we think we want to have our surrogate |
1766 | // react to the physics scene by moving it's position. | 1766 | // react to the physics scene by moving it's position. |
1767 | // Avatar to Avatar collisions | 1767 | // Avatar to Avatar collisions |
@@ -1782,7 +1782,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1782 | // We're flying and colliding with something | 1782 | // We're flying and colliding with something |
1783 | fx = ((_target_velocity.X) - vel.X) * (PID_D); | 1783 | fx = ((_target_velocity.X) - vel.X) * (PID_D); |
1784 | fy = ((_target_velocity.Y) - vel.Y) * (PID_D); | 1784 | fy = ((_target_velocity.Y) - vel.Y) * (PID_D); |
1785 | 1785 | ||
1786 | // vec.Z = (_target_velocity.Z - vel.Z) * PID_D + (_zeroPosition.Z - pos.Z) * PID_P; | 1786 | // vec.Z = (_target_velocity.Z - vel.Z) * PID_D + (_zeroPosition.Z - pos.Z) * PID_P; |
1787 | 1787 | ||
1788 | fz = fz + ((_target_velocity.Z - vel.Z) * (PID_D) * m_mass); | 1788 | fz = fz + ((_target_velocity.Z - vel.Z) * (PID_D) * m_mass); |
@@ -1793,7 +1793,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1793 | if (m_useHoverPID && !PIDActive) | 1793 | if (m_useHoverPID && !PIDActive) |
1794 | { | 1794 | { |
1795 | //Console.WriteLine("Hover " + Name); | 1795 | //Console.WriteLine("Hover " + Name); |
1796 | 1796 | ||
1797 | // If we're using the PID controller, then we have no gravity | 1797 | // If we're using the PID controller, then we have no gravity |
1798 | fz = (-1 * _parent_scene.gravityz) * m_mass; | 1798 | fz = (-1 * _parent_scene.gravityz) * m_mass; |
1799 | 1799 | ||
@@ -1850,7 +1850,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1850 | if (_target_velocity.ApproxEquals(Vector3.Zero, 0.1f)) | 1850 | if (_target_velocity.ApproxEquals(Vector3.Zero, 0.1f)) |
1851 | { | 1851 | { |
1852 | // keep track of where we stopped. No more slippin' & slidin' | 1852 | // keep track of where we stopped. No more slippin' & slidin' |
1853 | 1853 | ||
1854 | // We only want to deactivate the PID Controller if we think we want to have our surrogate | 1854 | // We only want to deactivate the PID Controller if we think we want to have our surrogate |
1855 | // react to the physics scene by moving it's position. | 1855 | // react to the physics scene by moving it's position. |
1856 | // Avatar to Avatar collisions | 1856 | // Avatar to Avatar collisions |
@@ -1888,7 +1888,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1888 | { | 1888 | { |
1889 | // A physical body at rest on a surface will auto-disable after a while, | 1889 | // A physical body at rest on a surface will auto-disable after a while, |
1890 | // this appears to re-enable it incase the surface it is upon vanishes, | 1890 | // this appears to re-enable it incase the surface it is upon vanishes, |
1891 | // and the body should fall again. | 1891 | // and the body should fall again. |
1892 | d.BodySetLinearVel(Body, 0f, 0f, 0f); | 1892 | d.BodySetLinearVel(Body, 0f, 0f, 0f); |
1893 | d.BodySetForce(Body, 0, 0, 0); | 1893 | d.BodySetForce(Body, 0, 0, 0); |
1894 | enableBodySoft(); | 1894 | enableBodySoft(); |
@@ -1897,7 +1897,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1897 | // 35x10 = 350n times the mass per second applied maximum. | 1897 | // 35x10 = 350n times the mass per second applied maximum. |
1898 | float nmax = 35f * m_mass; | 1898 | float nmax = 35f * m_mass; |
1899 | float nmin = -35f * m_mass; | 1899 | float nmin = -35f * m_mass; |
1900 | 1900 | ||
1901 | if (fx > nmax) | 1901 | if (fx > nmax) |
1902 | fx = nmax; | 1902 | fx = nmax; |
1903 | if (fx < nmin) | 1903 | if (fx < nmin) |
@@ -1916,7 +1916,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1916 | // _zeroPosition = d.BodyGetPosition(Body); | 1916 | // _zeroPosition = d.BodyGetPosition(Body); |
1917 | return; | 1917 | return; |
1918 | //Console.WriteLine("Nothing " + Name); | 1918 | //Console.WriteLine("Nothing " + Name); |
1919 | 1919 | ||
1920 | } | 1920 | } |
1921 | } | 1921 | } |
1922 | 1922 | ||
@@ -1942,7 +1942,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1942 | // daughter prim, do Geom set | 1942 | // daughter prim, do Geom set |
1943 | d.GeomSetQuaternion(prim_geom, ref myrot); | 1943 | d.GeomSetQuaternion(prim_geom, ref myrot); |
1944 | } | 1944 | } |
1945 | 1945 | ||
1946 | resetCollisionAccounting(); | 1946 | resetCollisionAccounting(); |
1947 | m_taintrot = _orientation; | 1947 | m_taintrot = _orientation; |
1948 | } | 1948 | } |
@@ -2080,7 +2080,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2080 | else | 2080 | else |
2081 | m_assetFailed = false; | 2081 | m_assetFailed = false; |
2082 | } | 2082 | } |
2083 | 2083 | ||
2084 | } | 2084 | } |
2085 | 2085 | ||
2086 | CreateGeom(m_targetSpace, mesh); | 2086 | CreateGeom(m_targetSpace, mesh); |
@@ -2312,7 +2312,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2312 | } | 2312 | } |
2313 | d.BodyEnable(Body); | 2313 | d.BodyEnable(Body); |
2314 | d.BodyAddTorque(Body, iforce.X, iforce.Y, iforce.Z); | 2314 | d.BodyAddTorque(Body, iforce.X, iforce.Y, iforce.Z); |
2315 | 2315 | ||
2316 | } | 2316 | } |
2317 | m_angularforcelist.Clear(); | 2317 | m_angularforcelist.Clear(); |
2318 | } | 2318 | } |
@@ -2342,7 +2342,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2342 | d.BodySetLinearVel(Body, m_taintVelocity.X, m_taintVelocity.Y, m_taintVelocity.Z); | 2342 | d.BodySetLinearVel(Body, m_taintVelocity.X, m_taintVelocity.Y, m_taintVelocity.Z); |
2343 | } | 2343 | } |
2344 | } | 2344 | } |
2345 | 2345 | ||
2346 | //resetCollisionAccounting(); | 2346 | //resetCollisionAccounting(); |
2347 | } | 2347 | } |
2348 | 2348 | ||
@@ -2686,7 +2686,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2686 | 2686 | ||
2687 | if(m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) | 2687 | if(m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) |
2688 | m_vehicle.Stop(); // this also updates vehicle last position from the body position | 2688 | m_vehicle.Stop(); // this also updates vehicle last position from the body position |
2689 | 2689 | ||
2690 | enableBodySoft(); | 2690 | enableBodySoft(); |
2691 | 2691 | ||
2692 | outofBounds = false; | 2692 | outofBounds = false; |
@@ -2899,12 +2899,12 @@ Console.WriteLine(" JointCreateFixed"); | |||
2899 | _acceleration = ((_velocity - m_lastVelocity) / 0.1f); | 2899 | _acceleration = ((_velocity - m_lastVelocity) / 0.1f); |
2900 | _acceleration = new Vector3(_velocity.X - m_lastVelocity.X / 0.1f, _velocity.Y - m_lastVelocity.Y / 0.1f, _velocity.Z - m_lastVelocity.Z / 0.1f); | 2900 | _acceleration = new Vector3(_velocity.X - m_lastVelocity.X / 0.1f, _velocity.Y - m_lastVelocity.Y / 0.1f, _velocity.Z - m_lastVelocity.Z / 0.1f); |
2901 | //m_log.Info("[PHYSICS]: V1: " + _velocity + " V2: " + m_lastVelocity + " Acceleration: " + _acceleration.ToString()); | 2901 | //m_log.Info("[PHYSICS]: V1: " + _velocity + " V2: " + m_lastVelocity + " Acceleration: " + _acceleration.ToString()); |
2902 | 2902 | ||
2903 | // Note here that linearvelocity is affecting angular velocity... so I'm guessing this is a vehicle specific thing... | 2903 | // Note here that linearvelocity is affecting angular velocity... so I'm guessing this is a vehicle specific thing... |
2904 | // it does make sense to do this for tiny little instabilities with physical prim, however 0.5m/frame is fairly large. | 2904 | // it does make sense to do this for tiny little instabilities with physical prim, however 0.5m/frame is fairly large. |
2905 | // reducing this to 0.02m/frame seems to help the angular rubberbanding quite a bit, however, to make sure it doesn't affect elevators and vehicles | 2905 | // reducing this to 0.02m/frame seems to help the angular rubberbanding quite a bit, however, to make sure it doesn't affect elevators and vehicles |
2906 | // adding these logical exclusion situations to maintain this where I think it was intended to be. | 2906 | // adding these logical exclusion situations to maintain this where I think it was intended to be. |
2907 | if (m_throttleUpdates || PIDActive || (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) || (Amotor != IntPtr.Zero)) | 2907 | if (m_throttleUpdates || PIDActive || (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) || (Amotor != IntPtr.Zero)) |
2908 | { | 2908 | { |
2909 | m_minvelocity = 0.5f; | 2909 | m_minvelocity = 0.5f; |
2910 | } | 2910 | } |
@@ -2973,8 +2973,8 @@ Console.WriteLine(" JointCreateFixed"); | |||
2973 | { | 2973 | { |
2974 | } | 2974 | } |
2975 | 2975 | ||
2976 | public override Vector3 PIDTarget | 2976 | public override Vector3 PIDTarget |
2977 | { | 2977 | { |
2978 | set | 2978 | set |
2979 | { | 2979 | { |
2980 | if (value.IsFinite()) | 2980 | if (value.IsFinite()) |
@@ -2983,7 +2983,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2983 | } | 2983 | } |
2984 | else | 2984 | else |
2985 | m_log.WarnFormat("[PHYSICS]: Got NaN PIDTarget from Scene on Object {0}", Name); | 2985 | m_log.WarnFormat("[PHYSICS]: Got NaN PIDTarget from Scene on Object {0}", Name); |
2986 | } | 2986 | } |
2987 | } | 2987 | } |
2988 | 2988 | ||
2989 | public override bool PIDActive { get; set; } | 2989 | public override bool PIDActive { get; set; } |
@@ -2993,7 +2993,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2993 | public override bool PIDHoverActive { get { return m_useHoverPID;} set { m_useHoverPID = value; } } | 2993 | public override bool PIDHoverActive { get { return m_useHoverPID;} set { m_useHoverPID = value; } } |
2994 | public override PIDHoverType PIDHoverType { set { m_PIDHoverType = value; } } | 2994 | public override PIDHoverType PIDHoverType { set { m_PIDHoverType = value; } } |
2995 | public override float PIDHoverTau { set { m_PIDHoverTau = value; } } | 2995 | public override float PIDHoverTau { set { m_PIDHoverTau = value; } } |
2996 | 2996 | ||
2997 | public override Quaternion APIDTarget{ set { return; } } | 2997 | public override Quaternion APIDTarget{ set { return; } } |
2998 | 2998 | ||
2999 | public override bool APIDActive{ set { return; } } | 2999 | public override bool APIDActive{ set { return; } } |
@@ -3189,7 +3189,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
3189 | // m_assetFailed = false; | 3189 | // m_assetFailed = false; |
3190 | 3190 | ||
3191 | // m_log.DebugFormat( | 3191 | // m_log.DebugFormat( |
3192 | // "[ODE PRIM]: Received mesh/sculpt data asset {0} with {1} bytes for {2} at {3} in {4}", | 3192 | // "[ODE PRIM]: Received mesh/sculpt data asset {0} with {1} bytes for {2} at {3} in {4}", |
3193 | // _pbs.SculptTexture, _pbs.SculptData.Length, Name, _position, _parent_scene.Name); | 3193 | // _pbs.SculptTexture, _pbs.SculptData.Length, Name, _position, _parent_scene.Name); |
3194 | 3194 | ||
3195 | m_taintshape = true; | 3195 | m_taintshape = true; |
@@ -3201,6 +3201,6 @@ Console.WriteLine(" JointCreateFixed"); | |||
3201 | "[ODE PRIM]: Could not get mesh/sculpt asset {0} for {1} at {2} in {3}", | 3201 | "[ODE PRIM]: Could not get mesh/sculpt asset {0} for {1} at {2} in {3}", |
3202 | _pbs.SculptTexture, Name, _position, _parent_scene.PhysicsSceneName); | 3202 | _pbs.SculptTexture, Name, _position, _parent_scene.PhysicsSceneName); |
3203 | } | 3203 | } |
3204 | } | 3204 | } |
3205 | } | 3205 | } |
3206 | } \ No newline at end of file | 3206 | } \ No newline at end of file |