diff options
author | Robert Adams | 2012-12-24 08:56:02 -0800 |
---|---|---|
committer | Robert Adams | 2012-12-24 08:56:02 -0800 |
commit | 80cee1b85a646045c02e2bb675056d532ce2fe27 (patch) | |
tree | dc9347a2eeb3241cdd30f50d448b630ce5d5c4f9 | |
parent | * Update BulletSimN terrain implementation to default to Heightfield, it's le... (diff) | |
download | opensim-SC_OLD-80cee1b85a646045c02e2bb675056d532ce2fe27.zip opensim-SC_OLD-80cee1b85a646045c02e2bb675056d532ce2fe27.tar.gz opensim-SC_OLD-80cee1b85a646045c02e2bb675056d532ce2fe27.tar.bz2 opensim-SC_OLD-80cee1b85a646045c02e2bb675056d532ce2fe27.tar.xz |
BulletSim: Fix single physical prim reporting its mass as zero.
Properly return root mass as mass of just the root prim rather
than the mass of the linkset. SOG has the logic to add the masses
together to get the linkset mass.
Update TODO list.
Diffstat (limited to '')
7 files changed, 83 insertions, 54 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index 8e059ee..bf0545a 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |||
@@ -174,7 +174,7 @@ public sealed class BSCharacter : BSPhysObject | |||
174 | BulletSimAPI.SetCcdSweptSphereRadius2(PhysBody.ptr, BSParam.CcdSweptSphereRadius); | 174 | BulletSimAPI.SetCcdSweptSphereRadius2(PhysBody.ptr, BSParam.CcdSweptSphereRadius); |
175 | } | 175 | } |
176 | 176 | ||
177 | UpdatePhysicalMassProperties(RawMass); | 177 | UpdatePhysicalMassProperties(RawMass, false); |
178 | 178 | ||
179 | // Make so capsule does not fall over | 179 | // Make so capsule does not fall over |
180 | BulletSimAPI.SetAngularFactorV2(PhysBody.ptr, OMV.Vector3.Zero); | 180 | BulletSimAPI.SetAngularFactorV2(PhysBody.ptr, OMV.Vector3.Zero); |
@@ -224,7 +224,7 @@ public sealed class BSCharacter : BSPhysObject | |||
224 | if (PhysBody.HasPhysicalBody && PhysShape.HasPhysicalShape) | 224 | if (PhysBody.HasPhysicalBody && PhysShape.HasPhysicalShape) |
225 | { | 225 | { |
226 | BulletSimAPI.SetLocalScaling2(PhysShape.ptr, Scale); | 226 | BulletSimAPI.SetLocalScaling2(PhysShape.ptr, Scale); |
227 | UpdatePhysicalMassProperties(RawMass); | 227 | UpdatePhysicalMassProperties(RawMass, true); |
228 | // Make sure this change appears as a property update event | 228 | // Make sure this change appears as a property update event |
229 | BulletSimAPI.PushUpdate2(PhysBody.ptr); | 229 | BulletSimAPI.PushUpdate2(PhysBody.ptr); |
230 | } | 230 | } |
@@ -390,7 +390,7 @@ public sealed class BSCharacter : BSPhysObject | |||
390 | public override float RawMass { | 390 | public override float RawMass { |
391 | get {return _mass; } | 391 | get {return _mass; } |
392 | } | 392 | } |
393 | public override void UpdatePhysicalMassProperties(float physMass) | 393 | public override void UpdatePhysicalMassProperties(float physMass, bool inWorld) |
394 | { | 394 | { |
395 | OMV.Vector3 localInertia = BulletSimAPI.CalculateLocalInertia2(PhysShape.ptr, physMass); | 395 | OMV.Vector3 localInertia = BulletSimAPI.CalculateLocalInertia2(PhysShape.ptr, physMass); |
396 | BulletSimAPI.SetMassProps2(PhysBody.ptr, physMass, localInertia); | 396 | BulletSimAPI.SetMassProps2(PhysBody.ptr, physMass, localInertia); |
@@ -772,8 +772,9 @@ public sealed class BSCharacter : BSPhysObject | |||
772 | // the motor can be turned off. Set the velocity to zero so the zero motion is sent to the viewer. | 772 | // the motor can be turned off. Set the velocity to zero so the zero motion is sent to the viewer. |
773 | if (_velocityMotor.TargetValue.ApproxEquals(OMV.Vector3.Zero, 0.01f) && _velocityMotor.ErrorIsZero) | 773 | if (_velocityMotor.TargetValue.ApproxEquals(OMV.Vector3.Zero, 0.01f) && _velocityMotor.ErrorIsZero) |
774 | { | 774 | { |
775 | stepVelocity = OMV.Vector3.Zero; | ||
776 | _velocityMotor.Enabled = false; | 775 | _velocityMotor.Enabled = false; |
776 | stepVelocity = OMV.Vector3.Zero; | ||
777 | ZeroMotion(true); | ||
777 | DetailLog("{0},BSCharacter.UpdateProperties,taint,disableVelocityMotor,m={1}", LocalID, _velocityMotor); | 778 | DetailLog("{0},BSCharacter.UpdateProperties,taint,disableVelocityMotor,m={1}", LocalID, _velocityMotor); |
778 | } | 779 | } |
779 | 780 | ||
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs index 8580928..756faed 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs | |||
@@ -97,14 +97,7 @@ public abstract class BSLinkset | |||
97 | } | 97 | } |
98 | 98 | ||
99 | // We keep the prim's mass in the linkset structure since it could be dependent on other prims | 99 | // We keep the prim's mass in the linkset structure since it could be dependent on other prims |
100 | protected float m_mass; | 100 | public float LinksetMass { get; protected set; } |
101 | public float LinksetMass | ||
102 | { | ||
103 | get | ||
104 | { | ||
105 | return m_mass; | ||
106 | } | ||
107 | } | ||
108 | 101 | ||
109 | public virtual bool LinksetIsColliding { get { return false; } } | 102 | public virtual bool LinksetIsColliding { get { return false; } } |
110 | 103 | ||
@@ -128,7 +121,7 @@ public abstract class BSLinkset | |||
128 | PhysicsScene = scene; | 121 | PhysicsScene = scene; |
129 | LinksetRoot = parent; | 122 | LinksetRoot = parent; |
130 | m_children = new HashSet<BSPhysObject>(); | 123 | m_children = new HashSet<BSPhysObject>(); |
131 | m_mass = parent.RawMass; | 124 | LinksetMass = parent.RawMass; |
132 | Rebuilding = false; | 125 | Rebuilding = false; |
133 | } | 126 | } |
134 | 127 | ||
@@ -143,7 +136,7 @@ public abstract class BSLinkset | |||
143 | // Don't add the root to its own linkset | 136 | // Don't add the root to its own linkset |
144 | if (!IsRoot(child)) | 137 | if (!IsRoot(child)) |
145 | AddChildToLinkset(child); | 138 | AddChildToLinkset(child); |
146 | m_mass = ComputeLinksetMass(); | 139 | LinksetMass = ComputeLinksetMass(); |
147 | } | 140 | } |
148 | return this; | 141 | return this; |
149 | } | 142 | } |
@@ -162,7 +155,7 @@ public abstract class BSLinkset | |||
162 | return this; | 155 | return this; |
163 | } | 156 | } |
164 | RemoveChildFromLinkset(child); | 157 | RemoveChildFromLinkset(child); |
165 | m_mass = ComputeLinksetMass(); | 158 | LinksetMass = ComputeLinksetMass(); |
166 | } | 159 | } |
167 | 160 | ||
168 | // The child is down to a linkset of just itself | 161 | // The child is down to a linkset of just itself |
@@ -230,7 +223,10 @@ public abstract class BSLinkset | |||
230 | // When physical properties are changed the linkset needs to recalculate | 223 | // When physical properties are changed the linkset needs to recalculate |
231 | // its internal properties. | 224 | // its internal properties. |
232 | // May be called at runtime or taint-time. | 225 | // May be called at runtime or taint-time. |
233 | public abstract void Refresh(BSPhysObject requestor); | 226 | public virtual void Refresh(BSPhysObject requestor) |
227 | { | ||
228 | LinksetMass = ComputeLinksetMass(); | ||
229 | } | ||
234 | 230 | ||
235 | // Flag denoting the linkset is in the process of being rebuilt. | 231 | // Flag denoting the linkset is in the process of being rebuilt. |
236 | // Used to know not the schedule a rebuild in the middle of a rebuild. | 232 | // Used to know not the schedule a rebuild in the middle of a rebuild. |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs index 2a7b72c..d5cbf5f 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | |||
@@ -5,7 +5,7 @@ | |||
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclat simer. |
9 | * * Redistributions in binary form must reproduce the above copyrightD | 9 | * * Redistributions in binary form must reproduce the above copyrightD |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
@@ -89,6 +89,8 @@ public sealed class BSLinksetCompound : BSLinkset | |||
89 | // its internal properties. | 89 | // its internal properties. |
90 | public override void Refresh(BSPhysObject requestor) | 90 | public override void Refresh(BSPhysObject requestor) |
91 | { | 91 | { |
92 | base.Refresh(requestor); | ||
93 | |||
92 | // Something changed so do the rebuilding thing | 94 | // Something changed so do the rebuilding thing |
93 | // ScheduleRebuild(); | 95 | // ScheduleRebuild(); |
94 | } | 96 | } |
@@ -96,13 +98,13 @@ public sealed class BSLinksetCompound : BSLinkset | |||
96 | // Schedule a refresh to happen after all the other taint processing. | 98 | // Schedule a refresh to happen after all the other taint processing. |
97 | private void ScheduleRebuild(BSPhysObject requestor) | 99 | private void ScheduleRebuild(BSPhysObject requestor) |
98 | { | 100 | { |
99 | DetailLog("{0},BSLinksetCompound.Refresh,schedulingRefresh,rebuilding={1}", | 101 | DetailLog("{0},BSLinksetCompound.ScheduleRebuild,,rebuilding={1}", |
100 | requestor.LocalID, Rebuilding); | 102 | requestor.LocalID, Rebuilding); |
101 | // When rebuilding, it is possible to set properties that would normally require a rebuild. | 103 | // When rebuilding, it is possible to set properties that would normally require a rebuild. |
102 | // If already rebuilding, don't request another rebuild. | 104 | // If already rebuilding, don't request another rebuild. |
103 | if (!Rebuilding) | 105 | if (!Rebuilding) |
104 | { | 106 | { |
105 | PhysicsScene.PostTaintObject("BSLinksetCompound.Refresh", LinksetRoot.LocalID, delegate() | 107 | PhysicsScene.PostTaintObject("BSLinksetCompound.ScheduleRebuild", LinksetRoot.LocalID, delegate() |
106 | { | 108 | { |
107 | if (HasAnyChildren) | 109 | if (HasAnyChildren) |
108 | RecomputeLinksetCompound(); | 110 | RecomputeLinksetCompound(); |
@@ -123,7 +125,6 @@ public sealed class BSLinksetCompound : BSLinkset | |||
123 | if (IsRoot(child)) | 125 | if (IsRoot(child)) |
124 | { | 126 | { |
125 | // The root is going dynamic. Make sure mass is properly set. | 127 | // The root is going dynamic. Make sure mass is properly set. |
126 | m_mass = ComputeLinksetMass(); | ||
127 | ScheduleRebuild(LinksetRoot); | 128 | ScheduleRebuild(LinksetRoot); |
128 | } | 129 | } |
129 | else | 130 | else |
@@ -377,8 +378,8 @@ public sealed class BSLinksetCompound : BSLinkset | |||
377 | }); | 378 | }); |
378 | 379 | ||
379 | // With all of the linkset packed into the root prim, it has the mass of everyone. | 380 | // With all of the linkset packed into the root prim, it has the mass of everyone. |
380 | float linksetMass = LinksetMass; | 381 | LinksetMass = LinksetMass; |
381 | LinksetRoot.UpdatePhysicalMassProperties(linksetMass); | 382 | LinksetRoot.UpdatePhysicalMassProperties(LinksetMass, true); |
382 | } | 383 | } |
383 | finally | 384 | finally |
384 | { | 385 | { |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs index d95f223..6b592e7 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs | |||
@@ -46,6 +46,8 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
46 | // refresh will happen once after all the other taints are applied. | 46 | // refresh will happen once after all the other taints are applied. |
47 | public override void Refresh(BSPhysObject requestor) | 47 | public override void Refresh(BSPhysObject requestor) |
48 | { | 48 | { |
49 | base.Refresh(requestor); | ||
50 | |||
49 | // Queue to happen after all the other taint processing | 51 | // Queue to happen after all the other taint processing |
50 | PhysicsScene.PostTaintObject("BSLinksetContraints.Refresh", requestor.LocalID, delegate() | 52 | PhysicsScene.PostTaintObject("BSLinksetContraints.Refresh", requestor.LocalID, delegate() |
51 | { | 53 | { |
@@ -279,7 +281,7 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
279 | private void RecomputeLinksetConstraints() | 281 | private void RecomputeLinksetConstraints() |
280 | { | 282 | { |
281 | float linksetMass = LinksetMass; | 283 | float linksetMass = LinksetMass; |
282 | LinksetRoot.UpdatePhysicalMassProperties(linksetMass); | 284 | LinksetRoot.UpdatePhysicalMassProperties(linksetMass, true); |
283 | 285 | ||
284 | // DEBUG: see of inter-linkset collisions are causing problems | 286 | // DEBUG: see of inter-linkset collisions are causing problems |
285 | // BulletSimAPI.SetCollisionFilterMask2(LinksetRoot.BSBody.ptr, | 287 | // BulletSimAPI.SetCollisionFilterMask2(LinksetRoot.BSBody.ptr, |
@@ -292,7 +294,7 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
292 | // A child in the linkset physically shows the mass of the whole linkset. | 294 | // A child in the linkset physically shows the mass of the whole linkset. |
293 | // This allows Bullet to apply enough force on the child to move the whole linkset. | 295 | // This allows Bullet to apply enough force on the child to move the whole linkset. |
294 | // (Also do the mass stuff before recomputing the constraint so mass is not zero.) | 296 | // (Also do the mass stuff before recomputing the constraint so mass is not zero.) |
295 | child.UpdatePhysicalMassProperties(linksetMass); | 297 | child.UpdatePhysicalMassProperties(linksetMass, true); |
296 | 298 | ||
297 | BSConstraint constrain; | 299 | BSConstraint constrain; |
298 | if (!PhysicsScene.Constraints.TryGetConstraint(LinksetRoot.PhysBody, child.PhysBody, out constrain)) | 300 | if (!PhysicsScene.Constraints.TryGetConstraint(LinksetRoot.PhysBody, child.PhysBody, out constrain)) |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs index c76f869..4bed535 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs | |||
@@ -96,7 +96,8 @@ public abstract class BSPhysObject : PhysicsActor | |||
96 | // Return the object mass without calculating it or having side effects | 96 | // Return the object mass without calculating it or having side effects |
97 | public abstract float RawMass { get; } | 97 | public abstract float RawMass { get; } |
98 | // Set the raw mass but also update physical mass properties (inertia, ...) | 98 | // Set the raw mass but also update physical mass properties (inertia, ...) |
99 | public abstract void UpdatePhysicalMassProperties(float mass); | 99 | // 'inWorld' true if the object has already been added to the dynamic world. |
100 | public abstract void UpdatePhysicalMassProperties(float mass, bool inWorld); | ||
100 | 101 | ||
101 | // The last value calculated for the prim's inertia | 102 | // The last value calculated for the prim's inertia |
102 | public OMV.Vector3 Inertia { get; set; } | 103 | public OMV.Vector3 Inertia { get; set; } |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 26b8df5..159f79f 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -115,6 +115,8 @@ public sealed class BSPrim : BSPhysObject | |||
115 | PhysBody = new BulletBody(LocalID); | 115 | PhysBody = new BulletBody(LocalID); |
116 | PhysShape = new BulletShape(); | 116 | PhysShape = new BulletShape(); |
117 | 117 | ||
118 | Linkset.Refresh(this); | ||
119 | |||
118 | DetailLog("{0},BSPrim.constructor,call", LocalID); | 120 | DetailLog("{0},BSPrim.constructor,call", LocalID); |
119 | // do the actual object creation at taint time | 121 | // do the actual object creation at taint time |
120 | PhysicsScene.TaintedObject("BSPrim.create", delegate() | 122 | PhysicsScene.TaintedObject("BSPrim.create", delegate() |
@@ -384,13 +386,13 @@ public sealed class BSPrim : BSPhysObject | |||
384 | } | 386 | } |
385 | 387 | ||
386 | // Return the effective mass of the object. | 388 | // Return the effective mass of the object. |
387 | // If there are multiple items in the linkset, add them together for the root | 389 | // The definition of this call is to return the mass of the prim. |
390 | // If the simulator cares about the mass of the linkset, it will sum it itself. | ||
388 | public override float Mass | 391 | public override float Mass |
389 | { | 392 | { |
390 | get | 393 | get |
391 | { | 394 | { |
392 | return Linkset.LinksetMass; | 395 | return _mass; |
393 | // return _mass; | ||
394 | } | 396 | } |
395 | } | 397 | } |
396 | 398 | ||
@@ -400,22 +402,41 @@ public sealed class BSPrim : BSPhysObject | |||
400 | } | 402 | } |
401 | // Set the physical mass to the passed mass. | 403 | // Set the physical mass to the passed mass. |
402 | // Note that this does not change _mass! | 404 | // Note that this does not change _mass! |
403 | public override void UpdatePhysicalMassProperties(float physMass) | 405 | public override void UpdatePhysicalMassProperties(float physMass, bool inWorld) |
404 | { | 406 | { |
405 | if (IsStatic) | 407 | if (PhysBody.HasPhysicalBody) |
406 | { | 408 | { |
407 | Inertia = OMV.Vector3.Zero; | 409 | if (IsStatic) |
408 | BulletSimAPI.SetMassProps2(PhysBody.ptr, 0f, Inertia); | 410 | { |
409 | BulletSimAPI.UpdateInertiaTensor2(PhysBody.ptr); | 411 | Inertia = OMV.Vector3.Zero; |
410 | } | 412 | BulletSimAPI.SetMassProps2(PhysBody.ptr, 0f, Inertia); |
411 | else | 413 | BulletSimAPI.UpdateInertiaTensor2(PhysBody.ptr); |
412 | { | 414 | } |
413 | Inertia = BulletSimAPI.CalculateLocalInertia2(PhysShape.ptr, physMass); | 415 | else |
414 | BulletSimAPI.SetMassProps2(PhysBody.ptr, physMass, Inertia); | 416 | { |
415 | BulletSimAPI.UpdateInertiaTensor2(PhysBody.ptr); | 417 | if (inWorld) |
416 | // center of mass is at the zero of the object | 418 | { |
417 | // DEBUG DEBUG BulletSimAPI.SetCenterOfMassByPosRot2(PhysBody.ptr, ForcePosition, ForceOrientation); | 419 | // Changing interesting properties doesn't change proxy and collision cache |
418 | DetailLog("{0},BSPrim.UpdateMassProperties,mass={1},localInertia={2}", LocalID, physMass, Inertia); | 420 | // information. The Bullet solution is to re-add the object to the world |
421 | // after parameters are changed. | ||
422 | BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, PhysBody.ptr); | ||
423 | } | ||
424 | |||
425 | float grav = PhysicsScene.Params.gravity * (1f - _buoyancy); | ||
426 | BulletSimAPI.SetGravity2(PhysBody.ptr, new OMV.Vector3(0f, 0f, grav)); | ||
427 | |||
428 | Inertia = BulletSimAPI.CalculateLocalInertia2(PhysShape.ptr, physMass); | ||
429 | BulletSimAPI.SetMassProps2(PhysBody.ptr, physMass, Inertia); | ||
430 | BulletSimAPI.UpdateInertiaTensor2(PhysBody.ptr); | ||
431 | // center of mass is at the zero of the object | ||
432 | // DEBUG DEBUG BulletSimAPI.SetCenterOfMassByPosRot2(PhysBody.ptr, ForcePosition, ForceOrientation); | ||
433 | DetailLog("{0},BSPrim.UpdateMassProperties,mass={1},localInertia={2}", LocalID, physMass, Inertia); | ||
434 | |||
435 | if (inWorld) | ||
436 | { | ||
437 | BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, PhysBody.ptr); | ||
438 | } | ||
439 | } | ||
419 | } | 440 | } |
420 | } | 441 | } |
421 | 442 | ||
@@ -714,7 +735,7 @@ public sealed class BSPrim : BSPhysObject | |||
714 | Linkset.Refresh(this); | 735 | Linkset.Refresh(this); |
715 | 736 | ||
716 | DetailLog("{0},BSPrim.UpdatePhysicalParameters,taintExit,static={1},solid={2},mass={3},collide={4},cf={5:X},body={6},shape={7}", | 737 | DetailLog("{0},BSPrim.UpdatePhysicalParameters,taintExit,static={1},solid={2},mass={3},collide={4},cf={5:X},body={6},shape={7}", |
717 | LocalID, IsStatic, IsSolid, _mass, SubscribedEvents(), CurrentCollisionFlags, PhysBody, PhysShape); | 738 | LocalID, IsStatic, IsSolid, Mass, SubscribedEvents(), CurrentCollisionFlags, PhysBody, PhysShape); |
718 | } | 739 | } |
719 | 740 | ||
720 | // "Making dynamic" means changing to and from static. | 741 | // "Making dynamic" means changing to and from static. |
@@ -737,7 +758,7 @@ public sealed class BSPrim : BSPhysObject | |||
737 | BulletSimAPI.SetRestitution2(PhysBody.ptr, matAttrib.restitution); | 758 | BulletSimAPI.SetRestitution2(PhysBody.ptr, matAttrib.restitution); |
738 | 759 | ||
739 | // Mass is zero which disables a bunch of physics stuff in Bullet | 760 | // Mass is zero which disables a bunch of physics stuff in Bullet |
740 | UpdatePhysicalMassProperties(0f); | 761 | UpdatePhysicalMassProperties(0f, false); |
741 | // Set collision detection parameters | 762 | // Set collision detection parameters |
742 | if (BSParam.CcdMotionThreshold > 0f) | 763 | if (BSParam.CcdMotionThreshold > 0f) |
743 | { | 764 | { |
@@ -777,7 +798,7 @@ public sealed class BSPrim : BSPhysObject | |||
777 | // DEBUG DEBUG BulletSimAPI.SetCenterOfMassByPosRot2(Linkset.LinksetRoot.PhysBody.ptr, _position, _orientation); | 798 | // DEBUG DEBUG BulletSimAPI.SetCenterOfMassByPosRot2(Linkset.LinksetRoot.PhysBody.ptr, _position, _orientation); |
778 | 799 | ||
779 | // A dynamic object has mass | 800 | // A dynamic object has mass |
780 | UpdatePhysicalMassProperties(RawMass); | 801 | UpdatePhysicalMassProperties(RawMass, false); |
781 | 802 | ||
782 | // Set collision detection parameters | 803 | // Set collision detection parameters |
783 | if (BSParam.CcdMotionThreshold > 0f) | 804 | if (BSParam.CcdMotionThreshold > 0f) |
@@ -950,13 +971,9 @@ public sealed class BSPrim : BSPhysObject | |||
950 | set { | 971 | set { |
951 | _buoyancy = value; | 972 | _buoyancy = value; |
952 | // DetailLog("{0},BSPrim.setForceBuoyancy,taint,buoy={1}", LocalID, _buoyancy); | 973 | // DetailLog("{0},BSPrim.setForceBuoyancy,taint,buoy={1}", LocalID, _buoyancy); |
953 | // Buoyancy is faked by changing the gravity applied to the object | 974 | // Force the recalculation of the various inertia,etc variables in the object |
954 | if (PhysBody.HasPhysicalBody) | 975 | UpdatePhysicalMassProperties(_mass, true); |
955 | { | 976 | ActivateIfPhysical(false); |
956 | float grav = PhysicsScene.Params.gravity * (1f - _buoyancy); | ||
957 | BulletSimAPI.SetGravity2(PhysBody.ptr, new OMV.Vector3(0f, 0f, grav)); | ||
958 | ActivateIfPhysical(false); | ||
959 | } | ||
960 | } | 977 | } |
961 | } | 978 | } |
962 | 979 | ||
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt index 9a7e965..0f27d67 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt | |||
@@ -1,11 +1,17 @@ | |||
1 | CURRENT PRIORITIES | 1 | CURRENT PRIORITIES |
2 | ================================================= | 2 | ================================================= |
3 | Smooth avatar movement with motor | 3 | Smooth avatar movement with motor (DONE) |
4 | Should motor update be all at taint-time? | 4 | Should motor update be all at taint-time? (Yes, DONE) |
5 | Fix avatar slowly sliding when standing (zero motion when stopped) | ||
6 | llApplyImpulse() | ||
7 | Compare mass/movement in OS and SL. Calibrate actions. | ||
8 | llSetBuoyancy() | ||
9 | Boats float low in the water | ||
5 | Enable vehicle border crossings (at least as poorly as ODE) | 10 | Enable vehicle border crossings (at least as poorly as ODE) |
6 | Terrain skirts | 11 | Terrain skirts |
7 | Avatar created in previous region and not new region when crossing border | 12 | Avatar created in previous region and not new region when crossing border |
8 | Vehicle recreated in new sim at small Z value (offset from root value?) (DONE) | 13 | Vehicle recreated in new sim at small Z value (offset from root value?) (DONE) |
14 | Add material densities to the material types. | ||
9 | Vehicle movement on terrain smoothness | 15 | Vehicle movement on terrain smoothness |
10 | Vehicle script tuning/debugging | 16 | Vehicle script tuning/debugging |
11 | Avanti speed script | 17 | Avanti speed script |
@@ -52,6 +58,8 @@ Incorporate inter-relationship of angular corrections. For instance, angularDefl | |||
52 | 58 | ||
53 | BULLETSIM TODO LIST: | 59 | BULLETSIM TODO LIST: |
54 | ================================================= | 60 | ================================================= |
61 | In SL, perfect spheres don't seem to have rolling friction. Add special case. | ||
62 | Avatar density is WAY off. Compare and calibrate with what's in SL. | ||
55 | Revisit CollisionMargin. Builders notice the 0.04 spacing between prims. | 63 | Revisit CollisionMargin. Builders notice the 0.04 spacing between prims. |
56 | Duplicating a physical prim causes old prim to jump away | 64 | Duplicating a physical prim causes old prim to jump away |
57 | Dup a phys prim and the original become unselected and thus interacts w/ selected prim. | 65 | Dup a phys prim and the original become unselected and thus interacts w/ selected prim. |
@@ -82,6 +90,9 @@ Linkset.Position and Linkset.Orientation requre rewrite to properly return | |||
82 | Implement LockAngularMotion -- implements llSetStatus(ROTATE_AXIS_*, T/F) | 90 | Implement LockAngularMotion -- implements llSetStatus(ROTATE_AXIS_*, T/F) |
83 | Should the different PID factors have non-equal contributions for different | 91 | Should the different PID factors have non-equal contributions for different |
84 | values of Efficiency? | 92 | values of Efficiency? |
93 | Selecting and deselecting physical objects causes CPU processing time to jump | ||
94 | http://www.youtube.com/watch?v=Hjg57fWg8yI&hd=1 | ||
95 | put thousand physical objects, select and deselect same. CPU time will be large. | ||
85 | 96 | ||
86 | LINKSETS | 97 | LINKSETS |
87 | ====================================================== | 98 | ====================================================== |