diff options
author | UbitUmarov | 2015-08-20 13:45:45 +0100 |
---|---|---|
committer | UbitUmarov | 2015-08-20 13:45:45 +0100 |
commit | 43a83da5ce4e26d21efe0fb06ba5e6d7a49e39c1 (patch) | |
tree | 496b8d69d6837e81dcaa52dfab182f9de11442bc /OpenSim/Region | |
parent | put back entities remove from updates on SendKillObject. (diff) | |
download | opensim-SC-43a83da5ce4e26d21efe0fb06ba5e6d7a49e39c1.zip opensim-SC-43a83da5ce4e26d21efe0fb06ba5e6d7a49e39c1.tar.gz opensim-SC-43a83da5ce4e26d21efe0fb06ba5e6d7a49e39c1.tar.bz2 opensim-SC-43a83da5ce4e26d21efe0fb06ba5e6d7a49e39c1.tar.xz |
update old git to os core version
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 58 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 44 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 11 |
4 files changed, 55 insertions, 60 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs index 288cab5..076da78 100644 --- a/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs +++ b/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs | |||
@@ -55,4 +55,4 @@ using System.Runtime.InteropServices; | |||
55 | // You can specify all values by your own or you can build default build and revision | 55 | // You can specify all values by your own or you can build default build and revision |
56 | // numbers with the '*' character (the default): | 56 | // numbers with the '*' character (the default): |
57 | 57 | ||
58 | [assembly : AssemblyVersion("0.8.0.*")] | 58 | [assembly : AssemblyVersion("0.8.2.*")] |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 86735de..05eaf2a 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | |||
@@ -167,6 +167,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
167 | /// <param name="avName"></param> | 167 | /// <param name="avName"></param> |
168 | /// <param name="parent_scene"></param> | 168 | /// <param name="parent_scene"></param> |
169 | /// <param name="pos"></param> | 169 | /// <param name="pos"></param> |
170 | /// <param name="vel"></param> | ||
170 | /// <param name="size"></param> | 171 | /// <param name="size"></param> |
171 | /// <param name="pid_d"></param> | 172 | /// <param name="pid_d"></param> |
172 | /// <param name="pid_p"></param> | 173 | /// <param name="pid_p"></param> |
@@ -178,7 +179,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
178 | /// <param name="walk_divisor"></param> | 179 | /// <param name="walk_divisor"></param> |
179 | /// <param name="rundivisor"></param> | 180 | /// <param name="rundivisor"></param> |
180 | public OdeCharacter( | 181 | public OdeCharacter( |
181 | String avName, OdeScene parent_scene, Vector3 pos, Vector3 size, float pid_d, float pid_p, | 182 | String avName, OdeScene parent_scene, Vector3 pos, Vector3 vel, Vector3 size, float pid_d, float pid_p, |
182 | float capsule_radius, float tensor, float density, | 183 | float capsule_radius, float tensor, float density, |
183 | float walk_divisor, float rundivisor) | 184 | float walk_divisor, float rundivisor) |
184 | { | 185 | { |
@@ -210,6 +211,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
210 | m_log.WarnFormat("[ODE CHARACTER]: Got NaN Position on Character Create for {0}", avName); | 211 | m_log.WarnFormat("[ODE CHARACTER]: Got NaN Position on Character Create for {0}", avName); |
211 | } | 212 | } |
212 | 213 | ||
214 | _velocity = vel; | ||
215 | m_taintTargetVelocity = vel; | ||
216 | |||
213 | _parent_scene = parent_scene; | 217 | _parent_scene = parent_scene; |
214 | 218 | ||
215 | PID_D = pid_d; | 219 | PID_D = pid_d; |
@@ -500,8 +504,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
500 | { | 504 | { |
501 | m_pidControllerActive = true; | 505 | m_pidControllerActive = true; |
502 | 506 | ||
503 | m_tainted_CAPSULE_LENGTH = (size.Z) - CAPSULE_RADIUS * 2.0f; | 507 | m_tainted_CAPSULE_LENGTH = size.Z - CAPSULE_RADIUS * 2.0f; |
504 | // m_log.Info("[ODE CHARACTER]: " + CAPSULE_LENGTH); | 508 | |
509 | // m_log.InfoFormat("[ODE CHARACTER]: Size = {0}, Capsule Length = {1} (Capsule Radius = {2})", | ||
510 | // size, m_tainted_CAPSULE_LENGTH, CAPSULE_RADIUS); | ||
505 | } | 511 | } |
506 | else | 512 | else |
507 | { | 513 | { |
@@ -890,42 +896,30 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
890 | // vec, _target_velocity, movementdivisor, vel); | 896 | // vec, _target_velocity, movementdivisor, vel); |
891 | } | 897 | } |
892 | 898 | ||
893 | if (m_iscolliding && !flying && _target_velocity.Z > 0.0f) | 899 | if (flying) |
894 | { | 900 | { |
895 | // We're colliding with something and we're not flying but we're moving | 901 | // This also acts as anti-gravity so that we hover when flying rather than fall. |
896 | // This means we're walking or running. | 902 | vec.Z = (_target_velocity.Z - vel.Z) * (PID_D); |
897 | d.Vector3 pos = d.BodyGetPosition(Body); | ||
898 | vec.Z = (_target_velocity.Z - vel.Z)*PID_D + (_zeroPosition.Z - pos.Z)*PID_P; | ||
899 | if (_target_velocity.X > 0) | ||
900 | { | ||
901 | vec.X = ((_target_velocity.X - vel.X) / 1.2f) * PID_D; | ||
902 | } | ||
903 | if (_target_velocity.Y > 0) | ||
904 | { | ||
905 | vec.Y = ((_target_velocity.Y - vel.Y) / 1.2f) * PID_D; | ||
906 | } | ||
907 | } | 903 | } |
908 | else if (!m_iscolliding && !flying) | 904 | else |
909 | { | 905 | { |
910 | // we're not colliding and we're not flying so that means we're falling! | 906 | if (m_iscolliding && _target_velocity.Z > 0.0f) |
911 | // m_iscolliding includes collisions with the ground. | ||
912 | |||
913 | // d.Vector3 pos = d.BodyGetPosition(Body); | ||
914 | if (_target_velocity.X > 0) | ||
915 | { | 907 | { |
908 | // We're colliding with something and we're not flying but we're moving | ||
909 | // This means we're walking or running. | ||
910 | d.Vector3 pos = d.BodyGetPosition(Body); | ||
911 | vec.Z = (_target_velocity.Z - vel.Z) * PID_D + (_zeroPosition.Z - pos.Z) * PID_P; | ||
916 | vec.X = ((_target_velocity.X - vel.X) / 1.2f) * PID_D; | 912 | vec.X = ((_target_velocity.X - vel.X) / 1.2f) * PID_D; |
913 | vec.Y = ((_target_velocity.Y - vel.Y) / 1.2f) * PID_D; | ||
917 | } | 914 | } |
918 | if (_target_velocity.Y > 0) | 915 | else if (!m_iscolliding) |
919 | { | 916 | { |
917 | // we're not colliding and we're not flying so that means we're falling! | ||
918 | // m_iscolliding includes collisions with the ground. | ||
919 | vec.X = ((_target_velocity.X - vel.X) / 1.2f) * PID_D; | ||
920 | vec.Y = ((_target_velocity.Y - vel.Y) / 1.2f) * PID_D; | 920 | vec.Y = ((_target_velocity.Y - vel.Y) / 1.2f) * PID_D; |
921 | } | 921 | } |
922 | } | 922 | } |
923 | |||
924 | if (flying) | ||
925 | { | ||
926 | // This also acts as anti-gravity so that we hover when flying rather than fall. | ||
927 | vec.Z = (_target_velocity.Z - vel.Z) * (PID_D); | ||
928 | } | ||
929 | } | 923 | } |
930 | 924 | ||
931 | if (flying) | 925 | if (flying) |
@@ -1255,7 +1249,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1255 | } | 1249 | } |
1256 | 1250 | ||
1257 | public override Vector3 PIDTarget { set { return; } } | 1251 | public override Vector3 PIDTarget { set { return; } } |
1258 | public override bool PIDActive { set { return; } } | 1252 | public override bool PIDActive |
1253 | { | ||
1254 | get { return false; } | ||
1255 | set { return; } | ||
1256 | } | ||
1259 | public override float PIDTau { set { return; } } | 1257 | public override float PIDTau { set { return; } } |
1260 | 1258 | ||
1261 | public override float PIDHoverHeight { set { return; } } | 1259 | public override float PIDHoverHeight { set { return; } } |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index b4b7e7f..f934b8a 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -114,7 +114,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
114 | private float m_PIDTau; | 114 | private float m_PIDTau; |
115 | private float PID_D = 35f; | 115 | private float PID_D = 35f; |
116 | private float PID_G = 25f; | 116 | private float PID_G = 25f; |
117 | private bool m_usePID; | ||
118 | 117 | ||
119 | // KF: These next 7 params apply to llSetHoverHeight(float height, integer water, float tau), | 118 | // KF: These next 7 params apply to llSetHoverHeight(float height, integer water, float tau), |
120 | // and are for non-VEHICLES only. | 119 | // and are for non-VEHICLES only. |
@@ -351,11 +350,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
351 | if (m_assetFailed) | 350 | if (m_assetFailed) |
352 | { | 351 | { |
353 | d.GeomSetCategoryBits(prim_geom, 0); | 352 | d.GeomSetCategoryBits(prim_geom, 0); |
354 | d.GeomSetCollideBits(prim_geom, BadAssetColideBits()); | 353 | d.GeomSetCollideBits(prim_geom, BadMeshAssetCollideBits); |
355 | } | 354 | } |
356 | else | 355 | else |
357 | { | 356 | { |
358 | |||
359 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | 357 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); |
360 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | 358 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); |
361 | } | 359 | } |
@@ -425,7 +423,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
425 | if (m_assetFailed) | 423 | if (m_assetFailed) |
426 | { | 424 | { |
427 | d.GeomSetCategoryBits(prim_geom, 0); | 425 | d.GeomSetCategoryBits(prim_geom, 0); |
428 | d.GeomSetCollideBits(prim_geom, BadAssetColideBits()); | 426 | d.GeomSetCollideBits(prim_geom, BadMeshAssetCollideBits); |
429 | } | 427 | } |
430 | else | 428 | else |
431 | { | 429 | { |
@@ -787,6 +785,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
787 | } | 785 | } |
788 | } | 786 | } |
789 | 787 | ||
788 | private void setAngularVelocity(float x, float y, float z) | ||
789 | { | ||
790 | if (Body != (IntPtr)0) | ||
791 | { | ||
792 | d.BodySetAngularVel(Body, x, y, z); | ||
793 | } | ||
794 | } | ||
795 | |||
790 | /// <summary> | 796 | /// <summary> |
791 | /// Stop a prim from being subject to physics. | 797 | /// Stop a prim from being subject to physics. |
792 | /// </summary> | 798 | /// </summary> |
@@ -858,11 +864,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
858 | 864 | ||
859 | private static Dictionary<IMesh, IntPtr> m_MeshToTriMeshMap = new Dictionary<IMesh, IntPtr>(); | 865 | private static Dictionary<IMesh, IntPtr> m_MeshToTriMeshMap = new Dictionary<IMesh, IntPtr>(); |
860 | 866 | ||
861 | public int BadAssetColideBits() | ||
862 | { | ||
863 | return (m_isphysical ? (int)CollisionCategories.Land : 0); | ||
864 | } | ||
865 | |||
866 | private void setMesh(OdeScene parent_scene, IMesh mesh) | 867 | private void setMesh(OdeScene parent_scene, IMesh mesh) |
867 | { | 868 | { |
868 | // m_log.DebugFormat("[ODE PRIM]: Setting mesh on {0} to {1}", Name, mesh); | 869 | // m_log.DebugFormat("[ODE PRIM]: Setting mesh on {0} to {1}", Name, mesh); |
@@ -1144,7 +1145,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1144 | if (prm.m_assetFailed) | 1145 | if (prm.m_assetFailed) |
1145 | { | 1146 | { |
1146 | d.GeomSetCategoryBits(prm.prim_geom, 0); | 1147 | d.GeomSetCategoryBits(prm.prim_geom, 0); |
1147 | d.GeomSetCollideBits(prm.prim_geom, prm.BadAssetColideBits()); | 1148 | d.GeomSetCollideBits(prm.prim_geom, prm.BadMeshAssetCollideBits); |
1148 | } | 1149 | } |
1149 | else | 1150 | else |
1150 | { | 1151 | { |
@@ -1198,7 +1199,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1198 | if (m_assetFailed) | 1199 | if (m_assetFailed) |
1199 | { | 1200 | { |
1200 | d.GeomSetCategoryBits(prim_geom, 0); | 1201 | d.GeomSetCategoryBits(prim_geom, 0); |
1201 | d.GeomSetCollideBits(prim_geom, BadAssetColideBits()); | 1202 | d.GeomSetCollideBits(prim_geom, BadMeshAssetCollideBits); |
1202 | } | 1203 | } |
1203 | else | 1204 | else |
1204 | { | 1205 | { |
@@ -1400,7 +1401,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1400 | if (m_assetFailed) | 1401 | if (m_assetFailed) |
1401 | { | 1402 | { |
1402 | d.GeomSetCategoryBits(prim_geom, 0); | 1403 | d.GeomSetCategoryBits(prim_geom, 0); |
1403 | d.GeomSetCollideBits(prim_geom, BadAssetColideBits()); | 1404 | d.GeomSetCollideBits(prim_geom, BadMeshAssetCollideBits); |
1404 | } | 1405 | } |
1405 | else | 1406 | else |
1406 | { | 1407 | { |
@@ -1729,7 +1730,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1729 | // gravityz multiplier = 1 - m_buoyancy | 1730 | // gravityz multiplier = 1 - m_buoyancy |
1730 | fz = _parent_scene.gravityz * (1.0f - m_buoyancy) * m_mass; | 1731 | fz = _parent_scene.gravityz * (1.0f - m_buoyancy) * m_mass; |
1731 | 1732 | ||
1732 | if (m_usePID) | 1733 | if (PIDActive) |
1733 | { | 1734 | { |
1734 | //Console.WriteLine("PID " + Name); | 1735 | //Console.WriteLine("PID " + Name); |
1735 | // KF - this is for object move? eg. llSetPos() ? | 1736 | // KF - this is for object move? eg. llSetPos() ? |
@@ -1798,10 +1799,10 @@ Console.WriteLine(" JointCreateFixed"); | |||
1798 | 1799 | ||
1799 | fz = fz + ((_target_velocity.Z - vel.Z) * (PID_D) * m_mass); | 1800 | fz = fz + ((_target_velocity.Z - vel.Z) * (PID_D) * m_mass); |
1800 | } | 1801 | } |
1801 | } // end if (m_usePID) | 1802 | } // end if (PIDActive) |
1802 | 1803 | ||
1803 | // Hover PID Controller needs to be mutually exlusive to MoveTo PID controller | 1804 | // Hover PID Controller needs to be mutually exlusive to MoveTo PID controller |
1804 | if (m_useHoverPID && !m_usePID) | 1805 | if (m_useHoverPID && !PIDActive) |
1805 | { | 1806 | { |
1806 | //Console.WriteLine("Hover " + Name); | 1807 | //Console.WriteLine("Hover " + Name); |
1807 | 1808 | ||
@@ -2144,7 +2145,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2144 | } | 2145 | } |
2145 | 2146 | ||
2146 | if (m_assetFailed) | 2147 | if (m_assetFailed) |
2147 | d.GeomSetCollideBits(prim_geom, BadAssetColideBits()); | 2148 | d.GeomSetCollideBits(prim_geom, BadMeshAssetCollideBits); |
2148 | else | 2149 | else |
2149 | 2150 | ||
2150 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | 2151 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); |
@@ -2652,6 +2653,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2652 | if (value.IsFinite()) | 2653 | if (value.IsFinite()) |
2653 | { | 2654 | { |
2654 | m_rotationalVelocity = value; | 2655 | m_rotationalVelocity = value; |
2656 | setAngularVelocity(value.X, value.Y, value.Z); | ||
2655 | } | 2657 | } |
2656 | else | 2658 | else |
2657 | { | 2659 | { |
@@ -2872,7 +2874,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2872 | // it does make sense to do this for tiny little instabilities with physical prim, however 0.5m/frame is fairly large. | 2874 | // it does make sense to do this for tiny little instabilities with physical prim, however 0.5m/frame is fairly large. |
2873 | // 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 | 2875 | // 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 |
2874 | // adding these logical exclusion situations to maintain this where I think it was intended to be. | 2876 | // adding these logical exclusion situations to maintain this where I think it was intended to be. |
2875 | if (m_throttleUpdates || m_usePID || (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) || (Amotor != IntPtr.Zero)) | 2877 | if (m_throttleUpdates || PIDActive || (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) || (Amotor != IntPtr.Zero)) |
2876 | { | 2878 | { |
2877 | m_minvelocity = 0.5f; | 2879 | m_minvelocity = 0.5f; |
2878 | } | 2880 | } |
@@ -2953,9 +2955,9 @@ Console.WriteLine(" JointCreateFixed"); | |||
2953 | m_log.WarnFormat("[PHYSICS]: Got NaN PIDTarget from Scene on Object {0}", Name); | 2955 | m_log.WarnFormat("[PHYSICS]: Got NaN PIDTarget from Scene on Object {0}", Name); |
2954 | } | 2956 | } |
2955 | } | 2957 | } |
2956 | public override bool PIDActive { set { m_usePID = value; } } | 2958 | public override bool PIDActive { get; set; } |
2957 | public override float PIDTau { set { m_PIDTau = value; } } | 2959 | public override float PIDTau { set { m_PIDTau = value; } } |
2958 | 2960 | ||
2959 | public override float PIDHoverHeight { set { m_PIDHoverHeight = value; ; } } | 2961 | public override float PIDHoverHeight { set { m_PIDHoverHeight = value; ; } } |
2960 | public override bool PIDHoverActive { set { m_useHoverPID = value; } } | 2962 | public override bool PIDHoverActive { set { m_useHoverPID = value; } } |
2961 | public override PIDHoverType PIDHoverType { set { m_PIDHoverType = value; } } | 2963 | public override PIDHoverType PIDHoverType { set { m_PIDHoverType = value; } } |
@@ -3350,7 +3352,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
3350 | RequestAssetDelegate assetProvider = _parent_scene.RequestAssetMethod; | 3352 | RequestAssetDelegate assetProvider = _parent_scene.RequestAssetMethod; |
3351 | if (assetProvider != null) | 3353 | if (assetProvider != null) |
3352 | assetProvider(_pbs.SculptTexture, MeshAssetReceived); | 3354 | assetProvider(_pbs.SculptTexture, MeshAssetReceived); |
3353 | }); | 3355 | }, null, "ODEPrim.CheckMeshAsset"); |
3354 | } | 3356 | } |
3355 | } | 3357 | } |
3356 | 3358 | ||
@@ -3382,4 +3384,4 @@ Console.WriteLine(" JointCreateFixed"); | |||
3382 | } | 3384 | } |
3383 | } | 3385 | } |
3384 | } | 3386 | } |
3385 | } | 3387 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 6d7f079..5953557 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs | |||
@@ -1969,16 +1969,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1969 | 1969 | ||
1970 | #region Add/Remove Entities | 1970 | #region Add/Remove Entities |
1971 | 1971 | ||
1972 | public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) | 1972 | public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying) |
1973 | { | 1973 | { |
1974 | Vector3 pos; | ||
1975 | pos.X = position.X; | ||
1976 | pos.Y = position.Y; | ||
1977 | pos.Z = position.Z; | ||
1978 | |||
1979 | OdeCharacter newAv | 1974 | OdeCharacter newAv |
1980 | = new OdeCharacter( | 1975 | = new OdeCharacter( |
1981 | avName, this, pos, size, avPIDD, avPIDP, | 1976 | avName, this, position, velocity, size, avPIDD, avPIDP, |
1982 | avCapRadius, avStandupTensor, avDensity, | 1977 | avCapRadius, avStandupTensor, avDensity, |
1983 | avMovementDivisorWalk, avMovementDivisorRun); | 1978 | avMovementDivisorWalk, avMovementDivisorRun); |
1984 | 1979 | ||