diff options
author | Robert Adams | 2013-07-11 14:33:03 -0700 |
---|---|---|
committer | Robert Adams | 2013-07-22 10:27:15 -0700 |
commit | b4c3a791aa55390bff071b3fe4bbe70c1d252703 (patch) | |
tree | 4823ba36ddaee6f13e7b11559d9701937ecf7cf1 /OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs | |
parent | Add experimental stubs for an extension function interface on both (diff) | |
download | opensim-SC-b4c3a791aa55390bff071b3fe4bbe70c1d252703.zip opensim-SC-b4c3a791aa55390bff071b3fe4bbe70c1d252703.tar.gz opensim-SC-b4c3a791aa55390bff071b3fe4bbe70c1d252703.tar.bz2 opensim-SC-b4c3a791aa55390bff071b3fe4bbe70c1d252703.tar.xz |
BulletSim: move collision processing for linksets from BSPrimLinkable
into the linkset implementation classes.
Add HasSomeCollision attribute that remembers of any component of
a linkset has a collision.
Update vehicle code (BSDynamic) to use the HasSomeCollision in place of
IsColliding to make constraint based linksets properly notice the ground.
Add linkset functions to change physical attributes of all the members
of a linkset.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs index 1fbcfcc..2f392da 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs | |||
@@ -200,20 +200,38 @@ public class BSPrimLinkable : BSPrimDisplaced | |||
200 | } | 200 | } |
201 | 201 | ||
202 | // Called after a simulation step to post a collision with this object. | 202 | // Called after a simulation step to post a collision with this object. |
203 | // This returns 'true' if the collision has been queued and the SendCollisions call must | ||
204 | // be made at the end of the simulation step. | ||
203 | public override bool Collide(uint collidingWith, BSPhysObject collidee, | 205 | public override bool Collide(uint collidingWith, BSPhysObject collidee, |
204 | OMV.Vector3 contactPoint, OMV.Vector3 contactNormal, float pentrationDepth) | 206 | OMV.Vector3 contactPoint, OMV.Vector3 contactNormal, float pentrationDepth) |
205 | { | 207 | { |
206 | // prims in the same linkset cannot collide with each other | 208 | bool ret = false; |
207 | BSPrimLinkable convCollidee = collidee as BSPrimLinkable; | 209 | // Ask the linkset if it wants to handle the collision |
208 | if (convCollidee != null && (this.Linkset.LinksetID == convCollidee.Linkset.LinksetID)) | 210 | if (!Linkset.HandleCollide(collidingWith, collidee, contactPoint, contactNormal, pentrationDepth)) |
209 | { | 211 | { |
210 | return false; | 212 | // The linkset didn't handle it so pass the collision through normal processing |
213 | ret = base.Collide(collidingWith, collidee, contactPoint, contactNormal, pentrationDepth); | ||
211 | } | 214 | } |
215 | return ret; | ||
216 | } | ||
212 | 217 | ||
213 | // TODO: handle collisions of other objects with with children of linkset. | 218 | // A linkset reports any collision on any part of the linkset. |
214 | // This is a problem for LinksetCompound since the children are packed into the root. | 219 | public long SomeCollisionSimulationStep = 0; |
220 | public override bool HasSomeCollision | ||
221 | { | ||
222 | get | ||
223 | { | ||
224 | return (SomeCollisionSimulationStep == PhysScene.SimulationStep) || base.IsColliding; | ||
225 | } | ||
226 | set | ||
227 | { | ||
228 | if (value) | ||
229 | SomeCollisionSimulationStep = PhysScene.SimulationStep; | ||
230 | else | ||
231 | SomeCollisionSimulationStep = 0; | ||
215 | 232 | ||
216 | return base.Collide(collidingWith, collidee, contactPoint, contactNormal, pentrationDepth); | 233 | base.HasSomeCollision = value; |
234 | } | ||
217 | } | 235 | } |
218 | } | 236 | } |
219 | } | 237 | } |