aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs45
1 files changed, 35 insertions, 10 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
index 1ac8c59..ead6a08 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
@@ -47,6 +47,7 @@ public abstract class BSPhysObject : PhysicsActor
47 TypeName = typeName; 47 TypeName = typeName;
48 48
49 Linkset = new BSLinkset(PhysicsScene, this); 49 Linkset = new BSLinkset(PhysicsScene, this);
50 LastAssetBuildFailed = false;
50 51
51 CollisionCollection = new CollisionEventUpdate(); 52 CollisionCollection = new CollisionEventUpdate();
52 SubscribedEventsMs = 0; 53 SubscribedEventsMs = 0;
@@ -69,6 +70,23 @@ public abstract class BSPhysObject : PhysicsActor
69 // Reference to the physical shape (btCollisionShape) of this object 70 // Reference to the physical shape (btCollisionShape) of this object
70 public BulletShape BSShape; 71 public BulletShape BSShape;
71 72
73 // 'true' if the mesh's underlying asset failed to build.
74 // This will keep us from looping after the first time the build failed.
75 public bool LastAssetBuildFailed { get; set; }
76
77 // The objects base shape information. Null if not a prim type shape.
78 public PrimitiveBaseShape BaseShape { get; protected set; }
79
80 // When the physical properties are updated, an EntityProperty holds the update values.
81 // Keep the current and last EntityProperties to enable computation of differences
82 // between the current update and the previous values.
83 public EntityProperties CurrentEntityProperties { get; set; }
84 public EntityProperties LastEntityProperties { get; set; }
85
86 public abstract OMV.Vector3 Scale { get; set; }
87 public abstract bool IsSolid { get; }
88 public abstract bool IsStatic { get; }
89
72 // Stop all physical motion. 90 // Stop all physical motion.
73 public abstract void ZeroMotion(); 91 public abstract void ZeroMotion();
74 92
@@ -85,6 +103,14 @@ public abstract class BSPhysObject : PhysicsActor
85 103
86 public abstract OMV.Quaternion ForceOrientation { get; set; } 104 public abstract OMV.Quaternion ForceOrientation { get; set; }
87 105
106 public abstract OMV.Vector3 ForceVelocity { get; set; }
107
108 public abstract OMV.Vector3 ForceRotationalVelocity { get; set; }
109
110 public abstract float ForceBuoyancy { get; set; }
111
112 public virtual bool ForceBodyShapeRebuild(bool inTaintTime) { return false; }
113
88 #region Collisions 114 #region Collisions
89 115
90 // Requested number of milliseconds between collision events. Zero means disabled. 116 // Requested number of milliseconds between collision events. Zero means disabled.
@@ -125,30 +151,28 @@ public abstract class BSPhysObject : PhysicsActor
125 // if someone has subscribed for collision events.... 151 // if someone has subscribed for collision events....
126 if (SubscribedEvents()) { 152 if (SubscribedEvents()) {
127 CollisionCollection.AddCollider(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth)); 153 CollisionCollection.AddCollider(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth));
128 // DetailLog("{0},{1}.Collison.AddCollider,call,with={2},point={3},normal={4},depth={5}", 154 DetailLog("{0},{1}.Collison.AddCollider,call,with={2},point={3},normal={4},depth={5}",
129 // LocalID, TypeName, collidingWith, contactPoint, contactNormal, pentrationDepth); 155 LocalID, TypeName, collidingWith, contactPoint, contactNormal, pentrationDepth);
130 156
131 ret = true; 157 ret = true;
132 } 158 }
133 return ret; 159 return ret;
134 } 160 }
135 161
136 // Routine to send the collected collisions into the simulator. 162 // Send the collected collisions into the simulator.
137 // Also handles removal of this from the collection of objects with collisions if
138 // there are no collisions from this object. Mechanism is create one last
139 // collision event to make collision_end work.
140 // Called at taint time from within the Step() function thus no locking problems 163 // Called at taint time from within the Step() function thus no locking problems
141 // with CollisionCollection and ObjectsWithNoMoreCollisions. 164 // with CollisionCollection and ObjectsWithNoMoreCollisions.
142 // Return 'true' if there were some actual collisions passed up 165 // Return 'true' if there were some actual collisions passed up
143 public virtual bool SendCollisions() 166 public virtual bool SendCollisions()
144 { 167 {
145 bool ret = true; 168 bool ret = true;
169 // If the 'no collision' call, force it to happen right now so quick collision_end
170 bool force = CollisionCollection.Count == 0;
146 171
147 // throttle the collisions to the number of milliseconds specified in the subscription 172 // throttle the collisions to the number of milliseconds specified in the subscription
148 int nowTime = PhysicsScene.SimulationNowTime; 173 if (force || (PhysicsScene.SimulationNowTime >= NextCollisionOkTime))
149 if (nowTime >= NextCollisionOkTime)
150 { 174 {
151 NextCollisionOkTime = nowTime + SubscribedEventsMs; 175 NextCollisionOkTime = PhysicsScene.SimulationNowTime + SubscribedEventsMs;
152 176
153 // We are called if we previously had collisions. If there are no collisions 177 // We are called if we previously had collisions. If there are no collisions
154 // this time, send up one last empty event so OpenSim can sense collision end. 178 // this time, send up one last empty event so OpenSim can sense collision end.
@@ -207,7 +231,8 @@ public abstract class BSPhysObject : PhysicsActor
207 // High performance detailed logging routine used by the physical objects. 231 // High performance detailed logging routine used by the physical objects.
208 protected void DetailLog(string msg, params Object[] args) 232 protected void DetailLog(string msg, params Object[] args)
209 { 233 {
210 PhysicsScene.PhysicsLogging.Write(msg, args); 234 if (PhysicsScene.PhysicsLogging.Enabled)
235 PhysicsScene.DetailLog(msg, args);
211 } 236 }
212} 237}
213} 238}