diff options
Diffstat (limited to 'OpenSim')
14 files changed, 328 insertions, 25 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index bcc9b37..ea4f2c7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1734,6 +1734,45 @@ namespace OpenSim.Region.Framework.Scenes | |||
1734 | } | 1734 | } |
1735 | } | 1735 | } |
1736 | 1736 | ||
1737 | public void rotLookAt(Quaternion target, float strength, float damping) | ||
1738 | { | ||
1739 | SceneObjectPart rootpart = m_rootPart; | ||
1740 | if (rootpart != null) | ||
1741 | { | ||
1742 | if (IsAttachment) | ||
1743 | { | ||
1744 | /* | ||
1745 | ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); | ||
1746 | if (avatar != null) | ||
1747 | { | ||
1748 | Rotate the Av? | ||
1749 | } */ | ||
1750 | } | ||
1751 | else | ||
1752 | { | ||
1753 | if (rootpart.PhysActor != null) | ||
1754 | { | ||
1755 | rootpart.PhysActor.APIDTarget = new Quaternion(target.X, target.Y, target.Z, target.W); | ||
1756 | rootpart.PhysActor.APIDStrength = strength; | ||
1757 | rootpart.PhysActor.APIDDamping = damping; | ||
1758 | rootpart.PhysActor.APIDActive = true; | ||
1759 | } | ||
1760 | } | ||
1761 | } | ||
1762 | } | ||
1763 | public void stopLookAt() | ||
1764 | { | ||
1765 | SceneObjectPart rootpart = m_rootPart; | ||
1766 | if (rootpart != null) | ||
1767 | { | ||
1768 | if (rootpart.PhysActor != null) | ||
1769 | { | ||
1770 | rootpart.PhysActor.APIDActive = false; | ||
1771 | } | ||
1772 | } | ||
1773 | |||
1774 | } | ||
1775 | |||
1737 | /// <summary> | 1776 | /// <summary> |
1738 | /// Uses a PID to attempt to clamp the object on the Z axis at the given height over tau seconds. | 1777 | /// Uses a PID to attempt to clamp the object on the Z axis at the given height over tau seconds. |
1739 | /// </summary> | 1778 | /// </summary> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index c0fd437..bf2f3d3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -2175,6 +2175,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2175 | ParentGroup.HasGroupChanged = true; | 2175 | ParentGroup.HasGroupChanged = true; |
2176 | ScheduleFullUpdate(); | 2176 | ScheduleFullUpdate(); |
2177 | } | 2177 | } |
2178 | |||
2179 | public void RotLookAt(Quaternion target, float strength, float damping) | ||
2180 | { | ||
2181 | m_parentGroup.rotLookAt(target, strength, damping); | ||
2182 | } | ||
2178 | 2183 | ||
2179 | /// <summary> | 2184 | /// <summary> |
2180 | /// Schedules this prim for a full update | 2185 | /// Schedules this prim for a full update |
@@ -2674,6 +2679,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2674 | SetText(text); | 2679 | SetText(text); |
2675 | } | 2680 | } |
2676 | 2681 | ||
2682 | public void StopLookAt() | ||
2683 | { | ||
2684 | m_parentGroup.stopLookAt(); | ||
2685 | |||
2686 | m_parentGroup.ScheduleGroupForTerseUpdate(); | ||
2687 | } | ||
2688 | |||
2677 | public void StopMoveToTarget() | 2689 | public void StopMoveToTarget() |
2678 | { | 2690 | { |
2679 | m_parentGroup.stopMoveToTarget(); | 2691 | m_parentGroup.stopMoveToTarget(); |
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs index 8df997e..f411dd7 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs | |||
@@ -303,6 +303,26 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
303 | set { return; } | 303 | set { return; } |
304 | } | 304 | } |
305 | 305 | ||
306 | public override Quaternion APIDTarget | ||
307 | { | ||
308 | set { return; } | ||
309 | } | ||
310 | |||
311 | public override bool APIDActive | ||
312 | { | ||
313 | set { return; } | ||
314 | } | ||
315 | |||
316 | public override float APIDStrength | ||
317 | { | ||
318 | set { return; } | ||
319 | } | ||
320 | |||
321 | public override float APIDDamping | ||
322 | { | ||
323 | set { return; } | ||
324 | } | ||
325 | |||
306 | public override void SubscribeEvents(int ms) | 326 | public override void SubscribeEvents(int ms) |
307 | { | 327 | { |
308 | } | 328 | } |
diff --git a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs index 5ed3b14..98681d6 100644 --- a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs +++ b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs | |||
@@ -619,6 +619,12 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
619 | { | 619 | { |
620 | set { return; } | 620 | set { return; } |
621 | } | 621 | } |
622 | |||
623 | public override Quaternion APIDTarget { set { return; } } | ||
624 | public override bool APIDActive { set { return; } } | ||
625 | public override float APIDStrength { set { return; } } | ||
626 | public override float APIDDamping { set { return; } } | ||
627 | |||
622 | 628 | ||
623 | /// <summary> | 629 | /// <summary> |
624 | /// Adds the force supplied to the Target Velocity | 630 | /// 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 5b542db..d931f126 100644 --- a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs +++ b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs | |||
@@ -565,6 +565,11 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
565 | public override PIDHoverType PIDHoverType { set { m_PIDHoverType = value; } } | 565 | public override PIDHoverType PIDHoverType { set { m_PIDHoverType = value; } } |
566 | public override float PIDHoverTau { set { m_PIDHoverTau = value; } } | 566 | public override float PIDHoverTau { set { m_PIDHoverTau = value; } } |
567 | 567 | ||
568 | public override Quaternion APIDTarget { set { return; } } | ||
569 | public override bool APIDActive { set { return; } } | ||
570 | public override float APIDStrength { set { return; } } | ||
571 | public override float APIDDamping { set { return; } } | ||
572 | |||
568 | 573 | ||
569 | public override void AddForce(Vector3 force, bool pushforce) | 574 | public override void AddForce(Vector3 force, bool pushforce) |
570 | { | 575 | { |
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs index 1e94ee2..d5d146e 100644 --- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs +++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs | |||
@@ -1238,6 +1238,26 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1238 | public override PIDHoverType PIDHoverType { set { return; } } | 1238 | public override PIDHoverType PIDHoverType { set { return; } } |
1239 | public override float PIDHoverTau { set { return; } } | 1239 | public override float PIDHoverTau { set { return; } } |
1240 | 1240 | ||
1241 | public override OpenMetaverse.Quaternion APIDTarget | ||
1242 | { | ||
1243 | set { return; } | ||
1244 | } | ||
1245 | |||
1246 | public override bool APIDActive | ||
1247 | { | ||
1248 | set { return; } | ||
1249 | } | ||
1250 | |||
1251 | public override float APIDStrength | ||
1252 | { | ||
1253 | set { return; } | ||
1254 | } | ||
1255 | |||
1256 | public override float APIDDamping | ||
1257 | { | ||
1258 | set { return; } | ||
1259 | } | ||
1260 | |||
1241 | 1261 | ||
1242 | public override void SubscribeEvents(int ms) | 1262 | public override void SubscribeEvents(int ms) |
1243 | { | 1263 | { |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index f58129d..b82586f 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs | |||
@@ -243,7 +243,12 @@ namespace OpenSim.Region.Physics.Manager | |||
243 | public abstract PIDHoverType PIDHoverType { set;} | 243 | public abstract PIDHoverType PIDHoverType { set;} |
244 | public abstract float PIDHoverTau { set;} | 244 | public abstract float PIDHoverTau { set;} |
245 | 245 | ||
246 | 246 | // For RotLookAt | |
247 | public abstract Quaternion APIDTarget { set;} | ||
248 | public abstract bool APIDActive { set;} | ||
249 | public abstract float APIDStrength { set;} | ||
250 | public abstract float APIDDamping { set;} | ||
251 | |||
247 | public abstract void AddForce(Vector3 force, bool pushforce); | 252 | public abstract void AddForce(Vector3 force, bool pushforce); |
248 | public abstract void AddAngularForce(Vector3 force, bool pushforce); | 253 | public abstract void AddAngularForce(Vector3 force, bool pushforce); |
249 | public abstract void SetMomentum(Vector3 momentum); | 254 | public abstract void SetMomentum(Vector3 momentum); |
@@ -476,6 +481,12 @@ namespace OpenSim.Region.Physics.Manager | |||
476 | public override bool PIDHoverActive { set { return; } } | 481 | public override bool PIDHoverActive { set { return; } } |
477 | public override PIDHoverType PIDHoverType { set { return; } } | 482 | public override PIDHoverType PIDHoverType { set { return; } } |
478 | public override float PIDHoverTau { set { return; } } | 483 | public override float PIDHoverTau { set { return; } } |
484 | |||
485 | public override Quaternion APIDTarget { set { return; } } | ||
486 | public override bool APIDActive { set { return; } } | ||
487 | public override float APIDStrength { set { return; } } | ||
488 | public override float APIDDamping { set { return; } } | ||
489 | |||
479 | 490 | ||
480 | public override void SetMomentum(Vector3 momentum) | 491 | public override void SetMomentum(Vector3 momentum) |
481 | { | 492 | { |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 1bc4a25..905d3ba 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | |||
@@ -1196,6 +1196,28 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1196 | public override bool PIDHoverActive { set { return; } } | 1196 | public override bool PIDHoverActive { set { return; } } |
1197 | public override PIDHoverType PIDHoverType { set { return; } } | 1197 | public override PIDHoverType PIDHoverType { set { return; } } |
1198 | public override float PIDHoverTau { set { return; } } | 1198 | public override float PIDHoverTau { set { return; } } |
1199 | |||
1200 | public override Quaternion APIDTarget | ||
1201 | { | ||
1202 | set { return; } | ||
1203 | } | ||
1204 | |||
1205 | public override bool APIDActive | ||
1206 | { | ||
1207 | set { return; } | ||
1208 | } | ||
1209 | |||
1210 | public override float APIDStrength | ||
1211 | { | ||
1212 | set { return; } | ||
1213 | } | ||
1214 | |||
1215 | public override float APIDDamping | ||
1216 | { | ||
1217 | set { return; } | ||
1218 | } | ||
1219 | |||
1220 | |||
1199 | 1221 | ||
1200 | public override void SubscribeEvents(int ms) | 1222 | public override void SubscribeEvents(int ms) |
1201 | { | 1223 | { |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs b/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs index 39cdc0f..78b15be 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs | |||
@@ -23,6 +23,19 @@ | |||
23 | * 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 |
24 | * (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 |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | ||
27 | * Revised Aug, Sept 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. | ||
38 | * | ||
26 | */ | 39 | */ |
27 | 40 | ||
28 | /* Revised Aug, Sept 2009 by Kitto Flora. ODEDynamics.cs replaces | 41 | /* Revised Aug, Sept 2009 by Kitto Flora. ODEDynamics.cs replaces |
@@ -120,7 +133,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
120 | // private float m_VhoverEfficiency = 0f; | 133 | // private float m_VhoverEfficiency = 0f; |
121 | private float m_VhoverTimescale = 0f; | 134 | private float m_VhoverTimescale = 0f; |
122 | private float m_VhoverTargetHeight = -1.0f; // if <0 then no hover, else its the current target height | 135 | private float m_VhoverTargetHeight = -1.0f; // if <0 then no hover, else its the current target height |
123 | private float m_VehicleBuoyancy = 0f; //KF: m_VehicleBuoyancy is set by VEHICLE_BUOYANCY for a vehicle. | 136 | private float m_VehicleBuoyancy = 0f; // Set by VEHICLE_BUOYANCY, for a vehicle. |
124 | // Modifies gravity. Slider between -1 (double-gravity) and 1 (full anti-gravity) | 137 | // Modifies gravity. Slider between -1 (double-gravity) and 1 (full anti-gravity) |
125 | // KF: So far I have found no good method to combine a script-requested .Z velocity and gravity. | 138 | // KF: So far I have found no good method to combine a script-requested .Z velocity and gravity. |
126 | // Therefore only m_VehicleBuoyancy=1 (0g) will use the script-requested .Z velocity. | 139 | // Therefore only m_VehicleBuoyancy=1 (0g) will use the script-requested .Z velocity. |
@@ -479,7 +492,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
479 | Quaternion rotq = new Quaternion(rot.X, rot.Y, rot.Z, rot.W); // rotq = rotation of object | 492 | Quaternion rotq = new Quaternion(rot.X, rot.Y, rot.Z, rot.W); // rotq = rotation of object |
480 | m_dir *= rotq; // apply obj rotation to velocity vector | 493 | m_dir *= rotq; // apply obj rotation to velocity vector |
481 | 494 | ||
482 | // add Gravity andBuoyancy | 495 | // add Gravity and Buoyancy |
483 | // KF: So far I have found no good method to combine a script-requested | 496 | // KF: So far I have found no good method to combine a script-requested |
484 | // .Z velocity and gravity. Therefore only 0g will used script-requested | 497 | // .Z velocity and gravity. Therefore only 0g will used script-requested |
485 | // .Z velocity. >0g (m_VehicleBuoyancy < 1) will used modified gravity only. | 498 | // .Z velocity. >0g (m_VehicleBuoyancy < 1) will used modified gravity only. |
@@ -561,6 +574,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
561 | private Vector3 m_angularFrictionTimescale = Vector3.Zero; // body angular velocity decay rate | 574 | private Vector3 m_angularFrictionTimescale = Vector3.Zero; // body angular velocity decay rate |
562 | private Vector3 m_lastAngularVelocity = Vector3.Zero; // what was last applied to body | 575 | private Vector3 m_lastAngularVelocity = Vector3.Zero; // what was last applied to body |
563 | */ | 576 | */ |
577 | //if(frcount == 0) Console.WriteLine("MoveAngular "); | ||
564 | 578 | ||
565 | // Get what the body is doing, this includes 'external' influences | 579 | // Get what the body is doing, this includes 'external' influences |
566 | d.Vector3 angularVelocity = d.BodyGetAngularVel(Body); | 580 | d.Vector3 angularVelocity = d.BodyGetAngularVel(Body); |
@@ -636,7 +650,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
636 | // Deflection section tba | 650 | // Deflection section tba |
637 | 651 | ||
638 | // Sum velocities | 652 | // Sum velocities |
639 | m_lastAngularVelocity = m_angularMotorVelocity + vertattr; // + bank + deflection | 653 | m_lastAngularVelocity = m_angularMotorVelocity + vertattr; // tba: + bank + deflection |
640 | 654 | ||
641 | if (!m_lastAngularVelocity.ApproxEquals(Vector3.Zero, 0.01f)) | 655 | if (!m_lastAngularVelocity.ApproxEquals(Vector3.Zero, 0.01f)) |
642 | { | 656 | { |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index fa42023..2bf96e4 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -21,6 +21,18 @@ | |||
21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 | * | ||
25 | * Revised August 26 2009 by Kitto Flora. ODEDynamics.cs replaces | ||
26 | * ODEVehicleSettings.cs. It and ODEPrim.cs are re-organised: | ||
27 | * ODEPrim.cs contains methods dealing with Prim editing, Prim | ||
28 | * characteristics and Kinetic motion. | ||
29 | * ODEDynamics.cs contains methods dealing with Prim Physical motion | ||
30 | * (dynamics) and the associated settings. Old Linear and angular | ||
31 | * motors for dynamic motion have been replace with MoveLinear() | ||
32 | * and MoveAngular(); 'Physical' is used only to switch ODE dynamic | ||
33 | * simualtion on/off; VEHICAL_TYPE_NONE/VEHICAL_TYPE_<other> is to | ||
34 | * switch between 'VEHICLE' parameter use and general dynamics | ||
35 | * settings use. | ||
24 | */ | 36 | */ |
25 | 37 | ||
26 | /* | 38 | /* |
@@ -81,7 +93,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
81 | private float m_PIDTau; | 93 | private float m_PIDTau; |
82 | private float PID_D = 35f; | 94 | private float PID_D = 35f; |
83 | private float PID_G = 25f; | 95 | private float PID_G = 25f; |
84 | private bool m_usePID; | 96 | private bool m_usePID = false; |
97 | |||
98 | private Quaternion m_APIDTarget = new Quaternion(); | ||
99 | private float m_APIDStrength = 0.5f; | ||
100 | private float m_APIDDamping = 0.5f; | ||
101 | private bool m_useAPID = false; | ||
85 | 102 | ||
86 | // KF: These next 7 params apply to llSetHoverHeight(float height, integer water, float tau), | 103 | // KF: These next 7 params apply to llSetHoverHeight(float height, integer water, float tau), |
87 | // and are for non-VEHICLES only. | 104 | // and are for non-VEHICLES only. |
@@ -182,6 +199,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
182 | private ODEDynamics m_vehicle; | 199 | private ODEDynamics m_vehicle; |
183 | 200 | ||
184 | internal int m_material = (int)Material.Wood; | 201 | internal int m_material = (int)Material.Wood; |
202 | |||
203 | private int frcount = 0; // Used to limit dynamics debug output to | ||
204 | |||
185 | 205 | ||
186 | public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size, | 206 | public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size, |
187 | Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical, CollisionLocker dode) | 207 | Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical, CollisionLocker dode) |
@@ -1558,9 +1578,14 @@ Console.WriteLine(" JointCreateFixed"); | |||
1558 | float fy = 0; | 1578 | float fy = 0; |
1559 | float fz = 0; | 1579 | float fz = 0; |
1560 | 1580 | ||
1581 | frcount++; // used to limit debug comment output | ||
1582 | if (frcount > 100) | ||
1583 | frcount = 0; | ||
1561 | 1584 | ||
1562 | if (IsPhysical && (Body != IntPtr.Zero) && !m_isSelected && !childPrim) // KF: Only move root prims. | 1585 | if (IsPhysical && (Body != IntPtr.Zero) && !m_isSelected && !childPrim) // KF: Only move root prims. |
1563 | { | 1586 | { |
1587 | //if(frcount == 0) Console.WriteLine("Move " + m_primName + " VTyp " + m_vehicle.Type + | ||
1588 | // " usePID=" + m_usePID + " seHover=" + m_useHoverPID + " useAPID=" + m_useAPID); | ||
1564 | if (m_vehicle.Type != Vehicle.TYPE_NONE) | 1589 | if (m_vehicle.Type != Vehicle.TYPE_NONE) |
1565 | { | 1590 | { |
1566 | // 'VEHICLES' are dealt with in ODEDynamics.cs | 1591 | // 'VEHICLES' are dealt with in ODEDynamics.cs |
@@ -1568,7 +1593,6 @@ Console.WriteLine(" JointCreateFixed"); | |||
1568 | } | 1593 | } |
1569 | else | 1594 | else |
1570 | { | 1595 | { |
1571 | //Console.WriteLine("Move " + m_primName); | ||
1572 | if(!d.BodyIsEnabled (Body)) d.BodyEnable (Body); // KF add 161009 | 1596 | if(!d.BodyIsEnabled (Body)) d.BodyEnable (Body); // KF add 161009 |
1573 | // NON-'VEHICLES' are dealt with here | 1597 | // NON-'VEHICLES' are dealt with here |
1574 | if (d.BodyIsEnabled(Body) && !m_angularlock.ApproxEquals(Vector3.Zero, 0.003f)) | 1598 | if (d.BodyIsEnabled(Body) && !m_angularlock.ApproxEquals(Vector3.Zero, 0.003f)) |
@@ -1590,21 +1614,18 @@ Console.WriteLine(" JointCreateFixed"); | |||
1590 | //m_log.Info(m_collisionFlags.ToString()); | 1614 | //m_log.Info(m_collisionFlags.ToString()); |
1591 | 1615 | ||
1592 | 1616 | ||
1593 | //KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle. | 1617 | //KF: m_buoyancy is set by llSetBuoyancy() and is for non-vehicle. |
1594 | // would come from SceneObjectPart.cs, public void SetBuoyancy(float fvalue) , PhysActor.Buoyancy = fvalue; ?? | ||
1595 | // m_buoyancy: (unlimited value) <0=Falls fast; 0=1g; 1=0g; >1 = floats up | 1618 | // m_buoyancy: (unlimited value) <0=Falls fast; 0=1g; 1=0g; >1 = floats up |
1596 | // gravityz multiplier = 1 - m_buoyancy | 1619 | // NB Prims in ODE are no subject to global gravity |
1597 | fz = _parent_scene.gravityz * (1.0f - m_buoyancy) * m_mass; | 1620 | fz = _parent_scene.gravityz * (1.0f - m_buoyancy) * m_mass; // force = acceleration * mass |
1598 | 1621 | ||
1599 | if (m_usePID) | 1622 | if (m_usePID) |
1600 | { | 1623 | { |
1601 | //Console.WriteLine("PID " + m_primName); | 1624 | //if(frcount == 0) Console.WriteLine("PID " + m_primName); |
1602 | // KF - this is for object move? eg. llSetPos() ? | 1625 | // KF - this is for object MoveToTarget. |
1626 | |||
1603 | //if (!d.BodyIsEnabled(Body)) | 1627 | //if (!d.BodyIsEnabled(Body)) |
1604 | //d.BodySetForce(Body, 0f, 0f, 0f); | 1628 | //d.BodySetForce(Body, 0f, 0f, 0f); |
1605 | // If we're using the PID controller, then we have no gravity | ||
1606 | //fz = (-1 * _parent_scene.gravityz) * m_mass; //KF: ?? Prims have no global gravity,so simply... | ||
1607 | fz = 0f; | ||
1608 | 1629 | ||
1609 | // no lock; for now it's only called from within Simulate() | 1630 | // no lock; for now it's only called from within Simulate() |
1610 | 1631 | ||
@@ -1739,7 +1760,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1739 | d.BodySetPosition(Body, pos.X, pos.Y, m_targetHoverHeight); | 1760 | d.BodySetPosition(Body, pos.X, pos.Y, m_targetHoverHeight); |
1740 | d.BodySetLinearVel(Body, vel.X, vel.Y, 0); | 1761 | d.BodySetLinearVel(Body, vel.X, vel.Y, 0); |
1741 | d.BodyAddForce(Body, 0, 0, fz); | 1762 | d.BodyAddForce(Body, 0, 0, fz); |
1742 | return; | 1763 | //KF this prevents furthur motions return; |
1743 | } | 1764 | } |
1744 | else | 1765 | else |
1745 | { | 1766 | { |
@@ -1748,8 +1769,46 @@ Console.WriteLine(" JointCreateFixed"); | |||
1748 | // We're flying and colliding with something | 1769 | // We're flying and colliding with something |
1749 | fz = fz + ((_target_velocity.Z - vel.Z) * (PID_D) * m_mass); | 1770 | fz = fz + ((_target_velocity.Z - vel.Z) * (PID_D) * m_mass); |
1750 | } | 1771 | } |
1751 | } | 1772 | } // end m_useHoverPID && !m_usePID |
1752 | 1773 | ||
1774 | if (m_useAPID) | ||
1775 | { | ||
1776 | // RotLookAt, apparently overrides all other rotation sources. Inputs: | ||
1777 | // Quaternion m_APIDTarget | ||
1778 | // float m_APIDStrength // From SL experiments, this is the time to get there | ||
1779 | // float m_APIDDamping // From SL experiments, this is damping, 1.0 = damped, 0.1 = wobbly | ||
1780 | // Also in SL the mass of the object has no effect on time to get there. | ||
1781 | // Factors: | ||
1782 | //if(frcount == 0) Console.WriteLine("APID "); | ||
1783 | // get present body rotation | ||
1784 | float limit = 1.0f; | ||
1785 | float scaler = 50f; // adjusts damping time | ||
1786 | float RLAservo = 0f; | ||
1787 | |||
1788 | d.Quaternion rot = d.BodyGetQuaternion(Body); | ||
1789 | Quaternion rotq = new Quaternion(rot.X, rot.Y, rot.Z, rot.W); | ||
1790 | Quaternion rot_diff = Quaternion.Inverse(rotq) * m_APIDTarget; | ||
1791 | float diff_angle; | ||
1792 | Vector3 diff_axis; | ||
1793 | rot_diff.GetAxisAngle(out diff_axis, out diff_angle); | ||
1794 | diff_axis.Normalize(); | ||
1795 | if(diff_angle > 0.01f) // diff_angle is always +ve | ||
1796 | { | ||
1797 | // PhysicsVector rotforce = new PhysicsVector(diff_axis.X, diff_axis.Y, diff_axis.Z); | ||
1798 | Vector3 rotforce = new Vector3(diff_axis.X, diff_axis.Y, diff_axis.Z); | ||
1799 | rotforce = rotforce * rotq; | ||
1800 | if(diff_angle > limit) diff_angle = limit; // cap the rotate rate | ||
1801 | // RLAservo = timestep / m_APIDStrength * m_mass * scaler; | ||
1802 | // rotforce = rotforce * RLAservo * diff_angle ; | ||
1803 | // d.BodyAddRelTorque(Body, rotforce.X, rotforce.Y, rotforce.Z); | ||
1804 | RLAservo = timestep / m_APIDStrength * scaler; | ||
1805 | rotforce = rotforce * RLAservo * diff_angle ; | ||
1806 | d.BodySetAngularVel (Body, rotforce.X, rotforce.Y, rotforce.Z); | ||
1807 | //Console.WriteLine("axis= " + diff_axis + " angle= " + diff_angle + "servo= " + RLAservo); | ||
1808 | } | ||
1809 | //if(frcount == 0) Console.WriteLine("mass= " + m_mass + " servo= " + RLAservo + " angle= " + diff_angle); | ||
1810 | } // end m_useAPID | ||
1811 | |||
1753 | fx *= m_mass; | 1812 | fx *= m_mass; |
1754 | fy *= m_mass; | 1813 | fy *= m_mass; |
1755 | //fz *= m_mass; | 1814 | //fz *= m_mass; |
@@ -2782,6 +2841,12 @@ Console.WriteLine(" JointCreateFixed"); | |||
2782 | } | 2841 | } |
2783 | public override bool PIDActive { set { m_usePID = value; } } | 2842 | public override bool PIDActive { set { m_usePID = value; } } |
2784 | public override float PIDTau { set { m_PIDTau = value; } } | 2843 | public override float PIDTau { set { m_PIDTau = value; } } |
2844 | |||
2845 | // For RotLookAt | ||
2846 | public override Quaternion APIDTarget { set { m_APIDTarget = value; } } | ||
2847 | public override bool APIDActive { set { m_useAPID = value; } } | ||
2848 | public override float APIDStrength { set { m_APIDStrength = value; } } | ||
2849 | public override float APIDDamping { set { m_APIDDamping = value; } } | ||
2785 | 2850 | ||
2786 | public override float PIDHoverHeight { set { m_PIDHoverHeight = value; ; } } | 2851 | public override float PIDHoverHeight { set { m_PIDHoverHeight = value; ; } } |
2787 | public override bool PIDHoverActive { set { m_useHoverPID = value; } } | 2852 | 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 26cd1dd..566b4e7 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs | |||
@@ -304,6 +304,27 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
304 | { | 304 | { |
305 | set { return; } | 305 | set { return; } |
306 | } | 306 | } |
307 | |||
308 | public override Quaternion APIDTarget | ||
309 | { | ||
310 | set { return; } | ||
311 | } | ||
312 | |||
313 | public override bool APIDActive | ||
314 | { | ||
315 | set { return; } | ||
316 | } | ||
317 | |||
318 | public override float APIDStrength | ||
319 | { | ||
320 | set { return; } | ||
321 | } | ||
322 | |||
323 | public override float APIDDamping | ||
324 | { | ||
325 | set { return; } | ||
326 | } | ||
327 | |||
307 | 328 | ||
308 | public override void SubscribeEvents(int ms) | 329 | public override void SubscribeEvents(int ms) |
309 | { | 330 | { |
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs index 96c3e26..847b634 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs | |||
@@ -299,6 +299,26 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
299 | { | 299 | { |
300 | set { return; } | 300 | set { return; } |
301 | } | 301 | } |
302 | public override Quaternion APIDTarget | ||
303 | { | ||
304 | set { return; } | ||
305 | } | ||
306 | |||
307 | public override bool APIDActive | ||
308 | { | ||
309 | set { return; } | ||
310 | } | ||
311 | |||
312 | public override float APIDStrength | ||
313 | { | ||
314 | set { return; } | ||
315 | } | ||
316 | |||
317 | public override float APIDDamping | ||
318 | { | ||
319 | set { return; } | ||
320 | } | ||
321 | |||
302 | 322 | ||
303 | public override void SubscribeEvents(int ms) | 323 | public override void SubscribeEvents(int ms) |
304 | { | 324 | { |
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs index 8bdb18d..24eb6b1 100644 --- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs +++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs | |||
@@ -498,6 +498,28 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
498 | public override bool PIDHoverActive { set { return; } } | 498 | public override bool PIDHoverActive { set { return; } } |
499 | public override PIDHoverType PIDHoverType { set { return; } } | 499 | public override PIDHoverType PIDHoverType { set { return; } } |
500 | public override float PIDHoverTau { set { return; } } | 500 | public override float PIDHoverTau { set { return; } } |
501 | |||
502 | public override Quaternion APIDTarget | ||
503 | { | ||
504 | set { return; } | ||
505 | } | ||
506 | |||
507 | public override bool APIDActive | ||
508 | { | ||
509 | set { return; } | ||
510 | } | ||
511 | |||
512 | public override float APIDStrength | ||
513 | { | ||
514 | set { return; } | ||
515 | } | ||
516 | |||
517 | public override float APIDDamping | ||
518 | { | ||
519 | set { return; } | ||
520 | } | ||
521 | |||
522 | |||
501 | 523 | ||
502 | public override void SubscribeEvents(int ms) | 524 | public override void SubscribeEvents(int ms) |
503 | { | 525 | { |
@@ -780,6 +802,28 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
780 | public override bool PIDHoverActive { set { return; } } | 802 | public override bool PIDHoverActive { set { return; } } |
781 | public override PIDHoverType PIDHoverType { set { return; } } | 803 | public override PIDHoverType PIDHoverType { set { return; } } |
782 | public override float PIDHoverTau { set { return; } } | 804 | public override float PIDHoverTau { set { return; } } |
805 | |||
806 | public override Quaternion APIDTarget | ||
807 | { | ||
808 | set { return; } | ||
809 | } | ||
810 | |||
811 | public override bool APIDActive | ||
812 | { | ||
813 | set { return; } | ||
814 | } | ||
815 | |||
816 | public override float APIDStrength | ||
817 | { | ||
818 | set { return; } | ||
819 | } | ||
820 | |||
821 | public override float APIDDamping | ||
822 | { | ||
823 | set { return; } | ||
824 | } | ||
825 | |||
826 | |||
783 | 827 | ||
784 | public override void SubscribeEvents(int ms) | 828 | public override void SubscribeEvents(int ms) |
785 | { | 829 | { |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 8eebf02..5fb2775 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -2699,11 +2699,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2699 | // Orient the object to the angle calculated | 2699 | // Orient the object to the angle calculated |
2700 | llSetRot(rot); | 2700 | llSetRot(rot); |
2701 | } | 2701 | } |
2702 | |||
2703 | public void llRotLookAt(LSL_Rotation target, double strength, double damping) | ||
2704 | { | ||
2705 | m_host.AddScriptLPS(1); | ||
2706 | // NotImplemented("llRotLookAt"); | ||
2707 | m_host.RotLookAt(Rot2Quaternion(target), (float)strength, (float)damping); | ||
2708 | |||
2709 | } | ||
2710 | |||
2702 | 2711 | ||
2703 | public void llStopLookAt() | 2712 | public void llStopLookAt() |
2704 | { | 2713 | { |
2705 | m_host.AddScriptLPS(1); | 2714 | m_host.AddScriptLPS(1); |
2706 | NotImplemented("llStopLookAt"); | 2715 | // NotImplemented("llStopLookAt"); |
2716 | m_host.StopLookAt(); | ||
2707 | } | 2717 | } |
2708 | 2718 | ||
2709 | public void llSetTimerEvent(double sec) | 2719 | public void llSetTimerEvent(double sec) |
@@ -3047,12 +3057,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3047 | m_host.AddScriptLPS(1); | 3057 | m_host.AddScriptLPS(1); |
3048 | } | 3058 | } |
3049 | 3059 | ||
3050 | public void llRotLookAt(LSL_Rotation target, double strength, double damping) | ||
3051 | { | ||
3052 | m_host.AddScriptLPS(1); | ||
3053 | NotImplemented("llRotLookAt"); | ||
3054 | } | ||
3055 | |||
3056 | public LSL_Integer llStringLength(string str) | 3060 | public LSL_Integer llStringLength(string str) |
3057 | { | 3061 | { |
3058 | m_host.AddScriptLPS(1); | 3062 | m_host.AddScriptLPS(1); |