diff options
author | KittoFlora | 2009-10-26 00:10:23 +0100 |
---|---|---|
committer | KittoFlora | 2009-10-26 00:10:23 +0100 |
commit | 8428b25939d39711e732eeb3928e8a8e64aad8a9 (patch) | |
tree | 4431c6743c579dcaa83a5f979496ccc574ae25e3 /OpenSim/Region | |
parent | Commented out instrumentation in ODEPrim.cs (diff) | |
download | opensim-SC-8428b25939d39711e732eeb3928e8a8e64aad8a9.zip opensim-SC-8428b25939d39711e732eeb3928e8a8e64aad8a9.tar.gz opensim-SC-8428b25939d39711e732eeb3928e8a8e64aad8a9.tar.bz2 opensim-SC-8428b25939d39711e732eeb3928e8a8e64aad8a9.tar.xz |
Add llRotLookat pt1.
Diffstat (limited to '')
14 files changed, 296 insertions, 31 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 69b3ded..fff807a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1727,6 +1727,45 @@ namespace OpenSim.Region.Framework.Scenes | |||
1727 | } | 1727 | } |
1728 | } | 1728 | } |
1729 | 1729 | ||
1730 | public void rotLookAt(Quaternion target, float strength, float damping) | ||
1731 | { | ||
1732 | SceneObjectPart rootpart = m_rootPart; | ||
1733 | if (rootpart != null) | ||
1734 | { | ||
1735 | if (IsAttachment) | ||
1736 | { | ||
1737 | /* | ||
1738 | ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); | ||
1739 | if (avatar != null) | ||
1740 | { | ||
1741 | Rotate the Av? | ||
1742 | } */ | ||
1743 | } | ||
1744 | else | ||
1745 | { | ||
1746 | if (rootpart.PhysActor != null) | ||
1747 | { | ||
1748 | rootpart.PhysActor.APIDTarget = new Quaternion(target.X, target.Y, target.Z, target.W); | ||
1749 | rootpart.PhysActor.APIDStrength = strength; | ||
1750 | rootpart.PhysActor.APIDDamping = damping; | ||
1751 | rootpart.PhysActor.APIDActive = true; | ||
1752 | } | ||
1753 | } | ||
1754 | } | ||
1755 | } | ||
1756 | public void stopLookAt() | ||
1757 | { | ||
1758 | SceneObjectPart rootpart = m_rootPart; | ||
1759 | if (rootpart != null) | ||
1760 | { | ||
1761 | if (rootpart.PhysActor != null) | ||
1762 | { | ||
1763 | rootpart.PhysActor.APIDActive = false; | ||
1764 | } | ||
1765 | } | ||
1766 | |||
1767 | } | ||
1768 | |||
1730 | /// <summary> | 1769 | /// <summary> |
1731 | /// Uses a PID to attempt to clamp the object on the Z axis at the given height over tau seconds. | 1770 | /// Uses a PID to attempt to clamp the object on the Z axis at the given height over tau seconds. |
1732 | /// </summary> | 1771 | /// </summary> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 32171a0..5f46f6f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -2187,6 +2187,11 @@ if (m_shape != null) { | |||
2187 | ParentGroup.HasGroupChanged = true; | 2187 | ParentGroup.HasGroupChanged = true; |
2188 | ScheduleFullUpdate(); | 2188 | ScheduleFullUpdate(); |
2189 | } | 2189 | } |
2190 | |||
2191 | public void RotLookAt(Quaternion target, float strength, float damping) | ||
2192 | { | ||
2193 | m_parentGroup.rotLookAt(target, strength, damping); | ||
2194 | } | ||
2190 | 2195 | ||
2191 | /// <summary> | 2196 | /// <summary> |
2192 | /// Schedules this prim for a full update | 2197 | /// Schedules this prim for a full update |
@@ -2662,6 +2667,13 @@ if (m_shape != null) { | |||
2662 | SetText(text); | 2667 | SetText(text); |
2663 | } | 2668 | } |
2664 | 2669 | ||
2670 | public void StopLookAt() | ||
2671 | { | ||
2672 | m_parentGroup.stopLookAt(); | ||
2673 | |||
2674 | m_parentGroup.ScheduleGroupForTerseUpdate(); | ||
2675 | } | ||
2676 | |||
2665 | public void StopMoveToTarget() | 2677 | public void StopMoveToTarget() |
2666 | { | 2678 | { |
2667 | m_parentGroup.stopMoveToTarget(); | 2679 | m_parentGroup.stopMoveToTarget(); |
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs index 8d8b3fe..2b905b6 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs | |||
@@ -307,6 +307,26 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
307 | set { return; } | 307 | set { return; } |
308 | } | 308 | } |
309 | 309 | ||
310 | public override Quaternion APIDTarget | ||
311 | { | ||
312 | set { return; } | ||
313 | } | ||
314 | |||
315 | public override bool APIDActive | ||
316 | { | ||
317 | set { return; } | ||
318 | } | ||
319 | |||
320 | public override float APIDStrength | ||
321 | { | ||
322 | set { return; } | ||
323 | } | ||
324 | |||
325 | public override float APIDDamping | ||
326 | { | ||
327 | set { return; } | ||
328 | } | ||
329 | |||
310 | public override void SubscribeEvents(int ms) | 330 | public override void SubscribeEvents(int ms) |
311 | { | 331 | { |
312 | } | 332 | } |
diff --git a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs index 8da9687..d7aed3c 100644 --- a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs +++ b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs | |||
@@ -627,6 +627,12 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
627 | { | 627 | { |
628 | set { return; } | 628 | set { return; } |
629 | } | 629 | } |
630 | |||
631 | public override Quaternion APIDTarget { set { return; } } | ||
632 | public override bool APIDActive { set { return; } } | ||
633 | public override float APIDStrength { set { return; } } | ||
634 | public override float APIDDamping { set { return; } } | ||
635 | |||
630 | 636 | ||
631 | /// <summary> | 637 | /// <summary> |
632 | /// Adds the force supplied to the Target Velocity | 638 | /// Adds the force supplied to the Target Velocity |
diff --git a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs index f22ea71..977b463 100644 --- a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs +++ b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs | |||
@@ -566,6 +566,11 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
566 | public override PIDHoverType PIDHoverType { set { m_PIDHoverType = value; } } | 566 | public override PIDHoverType PIDHoverType { set { m_PIDHoverType = value; } } |
567 | public override float PIDHoverTau { set { m_PIDHoverTau = value; } } | 567 | public override float PIDHoverTau { set { m_PIDHoverTau = value; } } |
568 | 568 | ||
569 | public override Quaternion APIDTarget { set { return; } } | ||
570 | public override bool APIDActive { set { return; } } | ||
571 | public override float APIDStrength { set { return; } } | ||
572 | public override float APIDDamping { set { return; } } | ||
573 | |||
569 | 574 | ||
570 | public override void AddForce(PhysicsVector force, bool pushforce) | 575 | public override void AddForce(PhysicsVector force, bool pushforce) |
571 | { | 576 | { |
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs index abed8df..14b8f39 100644 --- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs +++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs | |||
@@ -1236,6 +1236,26 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1236 | public override PIDHoverType PIDHoverType { set { return; } } | 1236 | public override PIDHoverType PIDHoverType { set { return; } } |
1237 | public override float PIDHoverTau { set { return; } } | 1237 | public override float PIDHoverTau { set { return; } } |
1238 | 1238 | ||
1239 | public override OpenMetaverse.Quaternion APIDTarget | ||
1240 | { | ||
1241 | set { return; } | ||
1242 | } | ||
1243 | |||
1244 | public override bool APIDActive | ||
1245 | { | ||
1246 | set { return; } | ||
1247 | } | ||
1248 | |||
1249 | public override float APIDStrength | ||
1250 | { | ||
1251 | set { return; } | ||
1252 | } | ||
1253 | |||
1254 | public override float APIDDamping | ||
1255 | { | ||
1256 | set { return; } | ||
1257 | } | ||
1258 | |||
1239 | 1259 | ||
1240 | public override void SubscribeEvents(int ms) | 1260 | public override void SubscribeEvents(int ms) |
1241 | { | 1261 | { |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index 7603131..566746a 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs | |||
@@ -230,7 +230,12 @@ namespace OpenSim.Region.Physics.Manager | |||
230 | public abstract PIDHoverType PIDHoverType { set;} | 230 | public abstract PIDHoverType PIDHoverType { set;} |
231 | public abstract float PIDHoverTau { set;} | 231 | public abstract float PIDHoverTau { set;} |
232 | 232 | ||
233 | 233 | // For RotLookAt | |
234 | public abstract Quaternion APIDTarget { set;} | ||
235 | public abstract bool APIDActive { set;} | ||
236 | public abstract float APIDStrength { set;} | ||
237 | public abstract float APIDDamping { set;} | ||
238 | |||
234 | public abstract void AddForce(PhysicsVector force, bool pushforce); | 239 | public abstract void AddForce(PhysicsVector force, bool pushforce); |
235 | public abstract void AddAngularForce(PhysicsVector force, bool pushforce); | 240 | public abstract void AddAngularForce(PhysicsVector force, bool pushforce); |
236 | public abstract void SetMomentum(PhysicsVector momentum); | 241 | public abstract void SetMomentum(PhysicsVector momentum); |
@@ -463,6 +468,12 @@ namespace OpenSim.Region.Physics.Manager | |||
463 | public override bool PIDHoverActive { set { return; } } | 468 | public override bool PIDHoverActive { set { return; } } |
464 | public override PIDHoverType PIDHoverType { set { return; } } | 469 | public override PIDHoverType PIDHoverType { set { return; } } |
465 | public override float PIDHoverTau { set { return; } } | 470 | public override float PIDHoverTau { set { return; } } |
471 | |||
472 | public override Quaternion APIDTarget { set { return; } } | ||
473 | public override bool APIDActive { set { return; } } | ||
474 | public override float APIDStrength { set { return; } } | ||
475 | public override float APIDDamping { set { return; } } | ||
476 | |||
466 | 477 | ||
467 | public override void SetMomentum(PhysicsVector momentum) | 478 | public override void SetMomentum(PhysicsVector momentum) |
468 | { | 479 | { |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 71ace16..8272083 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | |||
@@ -1205,6 +1205,28 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1205 | public override bool PIDHoverActive { set { return; } } | 1205 | public override bool PIDHoverActive { set { return; } } |
1206 | public override PIDHoverType PIDHoverType { set { return; } } | 1206 | public override PIDHoverType PIDHoverType { set { return; } } |
1207 | public override float PIDHoverTau { set { return; } } | 1207 | public override float PIDHoverTau { set { return; } } |
1208 | |||
1209 | public override Quaternion APIDTarget | ||
1210 | { | ||
1211 | set { return; } | ||
1212 | } | ||
1213 | |||
1214 | public override bool APIDActive | ||
1215 | { | ||
1216 | set { return; } | ||
1217 | } | ||
1218 | |||
1219 | public override float APIDStrength | ||
1220 | { | ||
1221 | set { return; } | ||
1222 | } | ||
1223 | |||
1224 | public override float APIDDamping | ||
1225 | { | ||
1226 | set { return; } | ||
1227 | } | ||
1228 | |||
1229 | |||
1208 | 1230 | ||
1209 | public override void SubscribeEvents(int ms) | 1231 | public override void SubscribeEvents(int ms) |
1210 | { | 1232 | { |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs b/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs index 467eba0..8b57f06 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs | |||
@@ -119,7 +119,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
119 | private float m_VhoverEfficiency = 0f; | 119 | private float m_VhoverEfficiency = 0f; |
120 | private float m_VhoverTimescale = 0f; | 120 | private float m_VhoverTimescale = 0f; |
121 | private float m_VhoverTargetHeight = -1.0f; // if <0 then no hover, else its the current target height | 121 | private float m_VhoverTargetHeight = -1.0f; // if <0 then no hover, else its the current target height |
122 | private float m_VehicleBuoyancy = 0f; //KF: m_VehicleBuoyancy is set by VEHICLE_BUOYANCY for a vehicle. | 122 | private float m_VehicleBuoyancy = 0f; // Set by VEHICLE_BUOYANCY, for a vehicle. |
123 | // Modifies gravity. Slider between -1 (double-gravity) and 1 (full anti-gravity) | 123 | // Modifies gravity. Slider between -1 (double-gravity) and 1 (full anti-gravity) |
124 | // KF: So far I have found no good method to combine a script-requested .Z velocity and gravity. | 124 | // KF: So far I have found no good method to combine a script-requested .Z velocity and gravity. |
125 | // Therefore only m_VehicleBuoyancy=1 (0g) will use the script-requested .Z velocity. | 125 | // Therefore only m_VehicleBuoyancy=1 (0g) will use the script-requested .Z velocity. |
@@ -478,7 +478,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
478 | Quaternion rotq = new Quaternion(rot.X, rot.Y, rot.Z, rot.W); // rotq = rotation of object | 478 | Quaternion rotq = new Quaternion(rot.X, rot.Y, rot.Z, rot.W); // rotq = rotation of object |
479 | m_dir *= rotq; // apply obj rotation to velocity vector | 479 | m_dir *= rotq; // apply obj rotation to velocity vector |
480 | 480 | ||
481 | // add Gravity andBuoyancy | 481 | // add Gravity and Buoyancy |
482 | // KF: So far I have found no good method to combine a script-requested | 482 | // KF: So far I have found no good method to combine a script-requested |
483 | // .Z velocity and gravity. Therefore only 0g will used script-requested | 483 | // .Z velocity and gravity. Therefore only 0g will used script-requested |
484 | // .Z velocity. >0g (m_VehicleBuoyancy < 1) will used modified gravity only. | 484 | // .Z velocity. >0g (m_VehicleBuoyancy < 1) will used modified gravity only. |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index f59f0ae..e1bf996 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -1,15 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Revised August 26 2009 by Kitto Flora. ODEDynamics.cs replaces | ||
3 | * ODEVehicleSettings.cs. It and ODEPrim.cs are re-organised: | ||
4 | * ODEPrim.cs contains methods dealing with Prim editing, Prim | ||
5 | * characteristics and Kinetic motion. | ||
6 | * ODEDynamics.cs contains methods dealing with Prim Physical motion | ||
7 | * (dynamics) and the associated settings. Old Linear and angular | ||
8 | * motors for dynamic motion have been replace with MoveLinear() | ||
9 | * and MoveAngular(); 'Physical' is used only to switch ODE dynamic | ||
10 | * simualtion on/off; VEHICAL_TYPE_NONE/VEHICAL_TYPE_<other> is to | ||
11 | * switch between 'VEHICLE' parameter use and general dynamics | ||
12 | * settings use. | ||
13 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
14 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
15 | * | 4 | * |
@@ -34,6 +23,18 @@ | |||
34 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
35 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
36 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | ||
27 | * Revised August 26 2009 by Kitto Flora. ODEDynamics.cs replaces | ||
28 | * ODEVehicleSettings.cs. It and ODEPrim.cs are re-organised: | ||
29 | * ODEPrim.cs contains methods dealing with Prim editing, Prim | ||
30 | * characteristics and Kinetic motion. | ||
31 | * ODEDynamics.cs contains methods dealing with Prim Physical motion | ||
32 | * (dynamics) and the associated settings. Old Linear and angular | ||
33 | * motors for dynamic motion have been replace with MoveLinear() | ||
34 | * and MoveAngular(); 'Physical' is used only to switch ODE dynamic | ||
35 | * simualtion on/off; VEHICAL_TYPE_NONE/VEHICAL_TYPE_<other> is to | ||
36 | * switch between 'VEHICLE' parameter use and general dynamics | ||
37 | * settings use. | ||
37 | */ | 38 | */ |
38 | using System; | 39 | using System; |
39 | using System.Collections.Generic; | 40 | using System.Collections.Generic; |
@@ -82,6 +83,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
82 | private float PID_D = 35f; | 83 | private float PID_D = 35f; |
83 | private float PID_G = 25f; | 84 | private float PID_G = 25f; |
84 | private bool m_usePID = false; | 85 | private bool m_usePID = false; |
86 | |||
87 | private Quaternion m_APIDTarget = new Quaternion(); | ||
88 | private float m_APIDStrength = 0.5f; | ||
89 | private float m_APIDDamping = 0.5f; | ||
90 | |||
91 | private float APID_D = 35f; | ||
92 | private float APID_G = 25f; | ||
93 | private bool m_useAPID = false; | ||
85 | 94 | ||
86 | // KF: These next 7 params apply to llSetHoverHeight(float height, integer water, float tau), | 95 | // KF: These next 7 params apply to llSetHoverHeight(float height, integer water, float tau), |
87 | // and are for non-VEHICLES only. | 96 | // and are for non-VEHICLES only. |
@@ -93,7 +102,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
93 | private float m_targetHoverHeight = 0f; | 102 | private float m_targetHoverHeight = 0f; |
94 | private float m_groundHeight = 0f; | 103 | private float m_groundHeight = 0f; |
95 | private float m_waterHeight = 0f; | 104 | private float m_waterHeight = 0f; |
96 | private float m_buoyancy = 0f; //KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle. | 105 | private float m_buoyancy = 0f; //Set by llSetBuoyancy(), for non-vehicles. |
97 | 106 | ||
98 | // private float m_tensor = 5f; | 107 | // private float m_tensor = 5f; |
99 | private int body_autodisable_frames = 20; | 108 | private int body_autodisable_frames = 20; |
@@ -1586,21 +1595,18 @@ Console.WriteLine(" JointCreateFixed"); | |||
1586 | //m_log.Info(m_collisionFlags.ToString()); | 1595 | //m_log.Info(m_collisionFlags.ToString()); |
1587 | 1596 | ||
1588 | 1597 | ||
1589 | //KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle. | 1598 | //KF: m_buoyancy is set by llSetBuoyancy() and is for non-vehicle. |
1590 | // would come from SceneObjectPart.cs, public void SetBuoyancy(float fvalue) , PhysActor.Buoyancy = fvalue; ?? | ||
1591 | // m_buoyancy: (unlimited value) <0=Falls fast; 0=1g; 1=0g; >1 = floats up | 1599 | // m_buoyancy: (unlimited value) <0=Falls fast; 0=1g; 1=0g; >1 = floats up |
1592 | // gravityz multiplier = 1 - m_buoyancy | 1600 | // NB Prims in ODE are no subject to global gravity |
1593 | fz = _parent_scene.gravityz * (1.0f - m_buoyancy) * m_mass; | 1601 | fz = _parent_scene.gravityz * (1.0f - m_buoyancy) * m_mass; // force = acceleration * mass |
1594 | 1602 | ||
1595 | if (m_usePID) | 1603 | if (m_usePID) |
1596 | { | 1604 | { |
1597 | //Console.WriteLine("PID " + m_primName); | 1605 | //Console.WriteLine("PID " + m_primName); |
1598 | // KF - this is for object move? eg. llSetPos() ? | 1606 | // KF - this is for object MoveToTarget. |
1607 | |||
1599 | //if (!d.BodyIsEnabled(Body)) | 1608 | //if (!d.BodyIsEnabled(Body)) |
1600 | //d.BodySetForce(Body, 0f, 0f, 0f); | 1609 | //d.BodySetForce(Body, 0f, 0f, 0f); |
1601 | // If we're using the PID controller, then we have no gravity | ||
1602 | //fz = (-1 * _parent_scene.gravityz) * m_mass; //KF: ?? Prims have no global gravity,so simply... | ||
1603 | fz = 0f; | ||
1604 | 1610 | ||
1605 | // no lock; for now it's only called from within Simulate() | 1611 | // no lock; for now it's only called from within Simulate() |
1606 | 1612 | ||
@@ -1744,8 +1750,37 @@ Console.WriteLine(" JointCreateFixed"); | |||
1744 | // We're flying and colliding with something | 1750 | // We're flying and colliding with something |
1745 | fz = fz + ((_target_velocity.Z - vel.Z) * (PID_D) * m_mass); | 1751 | fz = fz + ((_target_velocity.Z - vel.Z) * (PID_D) * m_mass); |
1746 | } | 1752 | } |
1747 | } | 1753 | } // end m_useHoverPID && !m_usePID |
1754 | |||
1755 | if (m_useAPID) | ||
1756 | { | ||
1757 | // RotLookAt, apparently overrides all other rotation sources. Inputs: | ||
1758 | // Quaternion m_APIDTarget | ||
1759 | // float m_APIDStrength // perhaps ratio other forces to lookat force? | ||
1760 | // float m_APIDDamping //'seconds to critically damps in'[sic] | ||
1761 | // Factors: | ||
1762 | // float APID_D | ||
1763 | // float APID_G | ||
1764 | |||
1765 | // get present body rotation | ||
1766 | d.Quaternion rot = d.BodyGetQuaternion(Body); | ||
1767 | Quaternion rotq = new Quaternion(rot.X, rot.Y, rot.Z, rot.W); | ||
1768 | Quaternion rot_diff = Quaternion.Inverse(rotq) * m_APIDTarget; | ||
1769 | float diff_angle; | ||
1770 | Vector3 diff_axis; | ||
1771 | rot_diff.GetAxisAngle(out diff_axis, out diff_angle); | ||
1772 | diff_axis.Normalize(); | ||
1773 | PhysicsVector rotforce = new PhysicsVector(diff_axis.X, diff_axis.Y, diff_axis.Z); | ||
1774 | float RLAservo = timestep / m_APIDDamping; | ||
1775 | rotforce = rotforce * RLAservo * m_mass; | ||
1776 | d.BodyAddTorque(Body, rotforce.X, rotforce.Y, rotforce.Z); | ||
1777 | |||
1778 | // d.BodySetAngularVel (Body, m_lastAngularVelocity.X, m_lastAngularVelocity.Y, m_lastAngularVelocity.Z); | ||
1748 | 1779 | ||
1780 | |||
1781 | |||
1782 | } // end m_useAPID | ||
1783 | |||
1749 | fx *= m_mass; | 1784 | fx *= m_mass; |
1750 | fy *= m_mass; | 1785 | fy *= m_mass; |
1751 | //fz *= m_mass; | 1786 | //fz *= m_mass; |
@@ -2778,6 +2813,12 @@ Console.WriteLine(" JointCreateFixed"); | |||
2778 | } | 2813 | } |
2779 | public override bool PIDActive { set { m_usePID = value; } } | 2814 | public override bool PIDActive { set { m_usePID = value; } } |
2780 | public override float PIDTau { set { m_PIDTau = value; } } | 2815 | public override float PIDTau { set { m_PIDTau = value; } } |
2816 | |||
2817 | // For RotLookAt | ||
2818 | public override Quaternion APIDTarget { set { m_APIDTarget = value; } } | ||
2819 | public override bool APIDActive { set { m_useAPID = value; } } | ||
2820 | public override float APIDStrength { set { m_APIDStrength = value; } } | ||
2821 | public override float APIDDamping { set { m_APIDDamping = value; } } | ||
2781 | 2822 | ||
2782 | public override float PIDHoverHeight { set { m_PIDHoverHeight = value; ; } } | 2823 | public override float PIDHoverHeight { set { m_PIDHoverHeight = value; ; } } |
2783 | public override bool PIDHoverActive { set { m_useHoverPID = value; } } | 2824 | public override bool PIDHoverActive { set { m_useHoverPID = value; } } |
diff --git a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs index 35fc616..135f49e 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs | |||
@@ -307,6 +307,27 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
307 | { | 307 | { |
308 | set { return; } | 308 | set { return; } |
309 | } | 309 | } |
310 | |||
311 | public override Quaternion APIDTarget | ||
312 | { | ||
313 | set { return; } | ||
314 | } | ||
315 | |||
316 | public override bool APIDActive | ||
317 | { | ||
318 | set { return; } | ||
319 | } | ||
320 | |||
321 | public override float APIDStrength | ||
322 | { | ||
323 | set { return; } | ||
324 | } | ||
325 | |||
326 | public override float APIDDamping | ||
327 | { | ||
328 | set { return; } | ||
329 | } | ||
330 | |||
310 | 331 | ||
311 | public override void SubscribeEvents(int ms) | 332 | public override void SubscribeEvents(int ms) |
312 | { | 333 | { |
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs index b50364b..4521dce 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs | |||
@@ -302,6 +302,26 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
302 | { | 302 | { |
303 | set { return; } | 303 | set { return; } |
304 | } | 304 | } |
305 | public override Quaternion APIDTarget | ||
306 | { | ||
307 | set { return; } | ||
308 | } | ||
309 | |||
310 | public override bool APIDActive | ||
311 | { | ||
312 | set { return; } | ||
313 | } | ||
314 | |||
315 | public override float APIDStrength | ||
316 | { | ||
317 | set { return; } | ||
318 | } | ||
319 | |||
320 | public override float APIDDamping | ||
321 | { | ||
322 | set { return; } | ||
323 | } | ||
324 | |||
305 | 325 | ||
306 | public override void SubscribeEvents(int ms) | 326 | public override void SubscribeEvents(int ms) |
307 | { | 327 | { |
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs index e7d989c..b3bf70b 100644 --- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs +++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs | |||
@@ -500,6 +500,28 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
500 | public override bool PIDHoverActive { set { return; } } | 500 | public override bool PIDHoverActive { set { return; } } |
501 | public override PIDHoverType PIDHoverType { set { return; } } | 501 | public override PIDHoverType PIDHoverType { set { return; } } |
502 | public override float PIDHoverTau { set { return; } } | 502 | public override float PIDHoverTau { set { return; } } |
503 | |||
504 | public override Quaternion APIDTarget | ||
505 | { | ||
506 | set { return; } | ||
507 | } | ||
508 | |||
509 | public override bool APIDActive | ||
510 | { | ||
511 | set { return; } | ||
512 | } | ||
513 | |||
514 | public override float APIDStrength | ||
515 | { | ||
516 | set { return; } | ||
517 | } | ||
518 | |||
519 | public override float APIDDamping | ||
520 | { | ||
521 | set { return; } | ||
522 | } | ||
523 | |||
524 | |||
503 | 525 | ||
504 | public override void SubscribeEvents(int ms) | 526 | public override void SubscribeEvents(int ms) |
505 | { | 527 | { |
@@ -782,6 +804,28 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
782 | public override bool PIDHoverActive { set { return; } } | 804 | public override bool PIDHoverActive { set { return; } } |
783 | public override PIDHoverType PIDHoverType { set { return; } } | 805 | public override PIDHoverType PIDHoverType { set { return; } } |
784 | public override float PIDHoverTau { set { return; } } | 806 | public override float PIDHoverTau { set { return; } } |
807 | |||
808 | public override Quaternion APIDTarget | ||
809 | { | ||
810 | set { return; } | ||
811 | } | ||
812 | |||
813 | public override bool APIDActive | ||
814 | { | ||
815 | set { return; } | ||
816 | } | ||
817 | |||
818 | public override float APIDStrength | ||
819 | { | ||
820 | set { return; } | ||
821 | } | ||
822 | |||
823 | public override float APIDDamping | ||
824 | { | ||
825 | set { return; } | ||
826 | } | ||
827 | |||
828 | |||
785 | 829 | ||
786 | public override void SubscribeEvents(int ms) | 830 | public override void SubscribeEvents(int ms) |
787 | { | 831 | { |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 11f255f..1dc20ff 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -2694,11 +2694,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2694 | // Orient the object to the angle calculated | 2694 | // Orient the object to the angle calculated |
2695 | llSetRot(rot); | 2695 | llSetRot(rot); |
2696 | } | 2696 | } |
2697 | |||
2698 | public void llRotLookAt(LSL_Rotation target, double strength, double damping) | ||
2699 | { | ||
2700 | m_host.AddScriptLPS(1); | ||
2701 | // NotImplemented("llRotLookAt"); | ||
2702 | m_host.RotLookAt(Rot2Quaternion(target), (float)strength, (float)damping); | ||
2703 | |||
2704 | } | ||
2705 | |||
2697 | 2706 | ||
2698 | public void llStopLookAt() | 2707 | public void llStopLookAt() |
2699 | { | 2708 | { |
2700 | m_host.AddScriptLPS(1); | 2709 | m_host.AddScriptLPS(1); |
2701 | NotImplemented("llStopLookAt"); | 2710 | // NotImplemented("llStopLookAt"); |
2711 | m_host.StopLookAt(); | ||
2702 | } | 2712 | } |
2703 | 2713 | ||
2704 | public void llSetTimerEvent(double sec) | 2714 | public void llSetTimerEvent(double sec) |
@@ -3042,12 +3052,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3042 | m_host.AddScriptLPS(1); | 3052 | m_host.AddScriptLPS(1); |
3043 | } | 3053 | } |
3044 | 3054 | ||
3045 | public void llRotLookAt(LSL_Rotation target, double strength, double damping) | ||
3046 | { | ||
3047 | m_host.AddScriptLPS(1); | ||
3048 | NotImplemented("llRotLookAt"); | ||
3049 | } | ||
3050 | |||
3051 | public LSL_Integer llStringLength(string str) | 3055 | public LSL_Integer llStringLength(string str) |
3052 | { | 3056 | { |
3053 | m_host.AddScriptLPS(1); | 3057 | m_host.AddScriptLPS(1); |