diff options
author | Melanie | 2012-11-04 22:44:42 +0000 |
---|---|---|
committer | Melanie | 2012-11-04 22:44:42 +0000 |
commit | c623e358057a9222e872ef648d847dfeb67852aa (patch) | |
tree | 63f474d313e78de31e9ec8b937912e18390903ff /OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |
parent | Merge branch 'avination' into careminster (diff) | |
parent | Add a method to query all registered script constants to allow non-XEngine (diff) | |
download | opensim-SC-c623e358057a9222e872ef648d847dfeb67852aa.zip opensim-SC-c623e358057a9222e872ef648d847dfeb67852aa.tar.gz opensim-SC-c623e358057a9222e872ef648d847dfeb67852aa.tar.bz2 opensim-SC-c623e358057a9222e872ef648d847dfeb67852aa.tar.xz |
Merge branch 'master' into careminster
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | 135 |
1 files changed, 69 insertions, 66 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index a041ba8..2a5397e 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |||
@@ -34,7 +34,7 @@ using OpenSim.Region.Physics.Manager; | |||
34 | 34 | ||
35 | namespace OpenSim.Region.Physics.BulletSPlugin | 35 | namespace OpenSim.Region.Physics.BulletSPlugin |
36 | { | 36 | { |
37 | public class BSCharacter : BSPhysObject | 37 | public sealed class BSCharacter : BSPhysObject |
38 | { | 38 | { |
39 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 39 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
40 | private static readonly string LogHeader = "[BULLETS CHAR]"; | 40 | private static readonly string LogHeader = "[BULLETS CHAR]"; |
@@ -97,28 +97,14 @@ public class BSCharacter : BSPhysObject | |||
97 | // set _avatarVolume and _mass based on capsule size, _density and Scale | 97 | // set _avatarVolume and _mass based on capsule size, _density and Scale |
98 | ComputeAvatarVolumeAndMass(); | 98 | ComputeAvatarVolumeAndMass(); |
99 | DetailLog("{0},BSCharacter.create,call,size={1},scale={2},density={3},volume={4},mass={5}", | 99 | DetailLog("{0},BSCharacter.create,call,size={1},scale={2},density={3},volume={4},mass={5}", |
100 | LocalID, _size, Scale, _avatarDensity, _avatarVolume, MassRaw); | 100 | LocalID, _size, Scale, _avatarDensity, _avatarVolume, RawMass); |
101 | |||
102 | ShapeData shapeData = new ShapeData(); | ||
103 | shapeData.ID = LocalID; | ||
104 | shapeData.Type = ShapeData.PhysicsShapeType.SHAPE_AVATAR; | ||
105 | shapeData.Position = _position; | ||
106 | shapeData.Rotation = _orientation; | ||
107 | shapeData.Velocity = _velocity; | ||
108 | shapeData.Size = Scale; // capsule is a native shape but scale is not just <1,1,1> | ||
109 | shapeData.Scale = Scale; | ||
110 | shapeData.Mass = _mass; | ||
111 | shapeData.Buoyancy = _buoyancy; | ||
112 | shapeData.Static = ShapeData.numericFalse; | ||
113 | shapeData.Friction = PhysicsScene.Params.avatarStandingFriction; | ||
114 | shapeData.Restitution = PhysicsScene.Params.avatarRestitution; | ||
115 | 101 | ||
116 | // do actual create at taint time | 102 | // do actual create at taint time |
117 | PhysicsScene.TaintedObject("BSCharacter.create", delegate() | 103 | PhysicsScene.TaintedObject("BSCharacter.create", delegate() |
118 | { | 104 | { |
119 | DetailLog("{0},BSCharacter.create,taint", LocalID); | 105 | DetailLog("{0},BSCharacter.create,taint", LocalID); |
120 | // New body and shape into BSBody and BSShape | 106 | // New body and shape into BSBody and BSShape |
121 | PhysicsScene.Shapes.GetBodyAndShape(true, PhysicsScene.World, this, shapeData, null, null, null); | 107 | PhysicsScene.Shapes.GetBodyAndShape(true, PhysicsScene.World, this, null, null); |
122 | 108 | ||
123 | SetPhysicalProperties(); | 109 | SetPhysicalProperties(); |
124 | }); | 110 | }); |
@@ -131,46 +117,45 @@ public class BSCharacter : BSPhysObject | |||
131 | DetailLog("{0},BSCharacter.Destroy", LocalID); | 117 | DetailLog("{0},BSCharacter.Destroy", LocalID); |
132 | PhysicsScene.TaintedObject("BSCharacter.destroy", delegate() | 118 | PhysicsScene.TaintedObject("BSCharacter.destroy", delegate() |
133 | { | 119 | { |
134 | PhysicsScene.Shapes.DereferenceBody(BSBody, true, null); | 120 | PhysicsScene.Shapes.DereferenceBody(PhysBody, true, null); |
135 | PhysicsScene.Shapes.DereferenceShape(BSShape, true, null); | 121 | PhysicsScene.Shapes.DereferenceShape(PhysShape, true, null); |
136 | }); | 122 | }); |
137 | } | 123 | } |
138 | 124 | ||
139 | private void SetPhysicalProperties() | 125 | private void SetPhysicalProperties() |
140 | { | 126 | { |
141 | BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, BSBody.ptr); | 127 | BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, PhysBody.ptr); |
142 | 128 | ||
143 | ZeroMotion(); | 129 | ZeroMotion(); |
144 | ForcePosition = _position; | 130 | ForcePosition = _position; |
145 | // Set the velocity and compute the proper friction | 131 | // Set the velocity and compute the proper friction |
146 | ForceVelocity = _velocity; | 132 | ForceVelocity = _velocity; |
147 | 133 | ||
148 | BulletSimAPI.SetRestitution2(BSBody.ptr, PhysicsScene.Params.avatarRestitution); | 134 | BulletSimAPI.SetRestitution2(PhysBody.ptr, PhysicsScene.Params.avatarRestitution); |
149 | BulletSimAPI.SetMargin2(BSShape.ptr, PhysicsScene.Params.collisionMargin); | 135 | BulletSimAPI.SetMargin2(PhysShape.ptr, PhysicsScene.Params.collisionMargin); |
150 | BulletSimAPI.SetLocalScaling2(BSShape.ptr, Scale); | 136 | BulletSimAPI.SetLocalScaling2(PhysShape.ptr, Scale); |
151 | BulletSimAPI.SetContactProcessingThreshold2(BSBody.ptr, PhysicsScene.Params.contactProcessingThreshold); | 137 | BulletSimAPI.SetContactProcessingThreshold2(PhysBody.ptr, PhysicsScene.Params.contactProcessingThreshold); |
152 | if (PhysicsScene.Params.ccdMotionThreshold > 0f) | 138 | if (PhysicsScene.Params.ccdMotionThreshold > 0f) |
153 | { | 139 | { |
154 | BulletSimAPI.SetCcdMotionThreshold2(BSBody.ptr, PhysicsScene.Params.ccdMotionThreshold); | 140 | BulletSimAPI.SetCcdMotionThreshold2(PhysBody.ptr, PhysicsScene.Params.ccdMotionThreshold); |
155 | BulletSimAPI.SetCcdSweepSphereRadius2(BSBody.ptr, PhysicsScene.Params.ccdSweptSphereRadius); | 141 | BulletSimAPI.SetCcdSweptSphereRadius2(PhysBody.ptr, PhysicsScene.Params.ccdSweptSphereRadius); |
156 | } | 142 | } |
157 | 143 | ||
158 | OMV.Vector3 localInertia = BulletSimAPI.CalculateLocalInertia2(BSShape.ptr, MassRaw); | 144 | UpdatePhysicalMassProperties(RawMass); |
159 | BulletSimAPI.SetMassProps2(BSBody.ptr, MassRaw, localInertia); | ||
160 | 145 | ||
161 | // Make so capsule does not fall over | 146 | // Make so capsule does not fall over |
162 | BulletSimAPI.SetAngularFactorV2(BSBody.ptr, OMV.Vector3.Zero); | 147 | BulletSimAPI.SetAngularFactorV2(PhysBody.ptr, OMV.Vector3.Zero); |
163 | 148 | ||
164 | BulletSimAPI.AddToCollisionFlags2(BSBody.ptr, CollisionFlags.CF_CHARACTER_OBJECT); | 149 | BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.CF_CHARACTER_OBJECT); |
165 | 150 | ||
166 | BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, BSBody.ptr); | 151 | BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, PhysBody.ptr); |
167 | 152 | ||
168 | // BulletSimAPI.ForceActivationState2(BSBody.ptr, ActivationState.ACTIVE_TAG); | 153 | // BulletSimAPI.ForceActivationState2(BSBody.ptr, ActivationState.ACTIVE_TAG); |
169 | BulletSimAPI.ForceActivationState2(BSBody.ptr, ActivationState.DISABLE_DEACTIVATION); | 154 | BulletSimAPI.ForceActivationState2(PhysBody.ptr, ActivationState.DISABLE_DEACTIVATION); |
170 | BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, BSBody.ptr); | 155 | BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, PhysBody.ptr); |
171 | 156 | ||
172 | // Do this after the object has been added to the world | 157 | // Do this after the object has been added to the world |
173 | BulletSimAPI.SetCollisionFilterMask2(BSBody.ptr, | 158 | BulletSimAPI.SetCollisionFilterMask2(PhysBody.ptr, |
174 | (uint)CollisionFilterGroups.AvatarFilter, | 159 | (uint)CollisionFilterGroups.AvatarFilter, |
175 | (uint)CollisionFilterGroups.AvatarMask); | 160 | (uint)CollisionFilterGroups.AvatarMask); |
176 | } | 161 | } |
@@ -196,13 +181,12 @@ public class BSCharacter : BSPhysObject | |||
196 | ComputeAvatarScale(_size); | 181 | ComputeAvatarScale(_size); |
197 | ComputeAvatarVolumeAndMass(); | 182 | ComputeAvatarVolumeAndMass(); |
198 | DetailLog("{0},BSCharacter.setSize,call,scale={1},density={2},volume={3},mass={4}", | 183 | DetailLog("{0},BSCharacter.setSize,call,scale={1},density={2},volume={3},mass={4}", |
199 | LocalID, Scale, _avatarDensity, _avatarVolume, MassRaw); | 184 | LocalID, Scale, _avatarDensity, _avatarVolume, RawMass); |
200 | 185 | ||
201 | PhysicsScene.TaintedObject("BSCharacter.setSize", delegate() | 186 | PhysicsScene.TaintedObject("BSCharacter.setSize", delegate() |
202 | { | 187 | { |
203 | BulletSimAPI.SetLocalScaling2(BSShape.ptr, Scale); | 188 | BulletSimAPI.SetLocalScaling2(PhysShape.ptr, Scale); |
204 | OMV.Vector3 localInertia = BulletSimAPI.CalculateLocalInertia2(BSShape.ptr, MassRaw); | 189 | UpdatePhysicalMassProperties(RawMass); |
205 | BulletSimAPI.SetMassProps2(BSBody.ptr, MassRaw, localInertia); | ||
206 | }); | 190 | }); |
207 | 191 | ||
208 | } | 192 | } |
@@ -214,6 +198,11 @@ public class BSCharacter : BSPhysObject | |||
214 | { | 198 | { |
215 | set { BaseShape = value; } | 199 | set { BaseShape = value; } |
216 | } | 200 | } |
201 | // I want the physics engine to make an avatar capsule | ||
202 | public override ShapeData.PhysicsShapeType PreferredPhysicalShape | ||
203 | { | ||
204 | get {return ShapeData.PhysicsShapeType.SHAPE_AVATAR; } | ||
205 | } | ||
217 | 206 | ||
218 | public override bool Grabbed { | 207 | public override bool Grabbed { |
219 | set { _grabbed = value; } | 208 | set { _grabbed = value; } |
@@ -236,16 +225,22 @@ public class BSCharacter : BSPhysObject | |||
236 | _rotationalVelocity = OMV.Vector3.Zero; | 225 | _rotationalVelocity = OMV.Vector3.Zero; |
237 | 226 | ||
238 | // Zero some other properties directly into the physics engine | 227 | // Zero some other properties directly into the physics engine |
239 | BulletSimAPI.SetLinearVelocity2(BSBody.ptr, OMV.Vector3.Zero); | 228 | BulletSimAPI.SetLinearVelocity2(PhysBody.ptr, OMV.Vector3.Zero); |
240 | BulletSimAPI.SetAngularVelocity2(BSBody.ptr, OMV.Vector3.Zero); | 229 | BulletSimAPI.SetAngularVelocity2(PhysBody.ptr, OMV.Vector3.Zero); |
241 | BulletSimAPI.SetInterpolationVelocity2(BSBody.ptr, OMV.Vector3.Zero, OMV.Vector3.Zero); | 230 | BulletSimAPI.SetInterpolationVelocity2(PhysBody.ptr, OMV.Vector3.Zero, OMV.Vector3.Zero); |
242 | BulletSimAPI.ClearForces2(BSBody.ptr); | 231 | BulletSimAPI.ClearForces2(PhysBody.ptr); |
243 | } | 232 | } |
244 | 233 | ||
245 | public override void LockAngularMotion(OMV.Vector3 axis) { return; } | 234 | public override void LockAngularMotion(OMV.Vector3 axis) { return; } |
246 | 235 | ||
236 | public override OMV.Vector3 RawPosition | ||
237 | { | ||
238 | get { return _position; } | ||
239 | set { _position = value; } | ||
240 | } | ||
247 | public override OMV.Vector3 Position { | 241 | public override OMV.Vector3 Position { |
248 | get { | 242 | get { |
243 | // Don't refetch the position because this function is called a zillion times | ||
249 | // _position = BulletSimAPI.GetObjectPosition2(Scene.World.ptr, LocalID); | 244 | // _position = BulletSimAPI.GetObjectPosition2(Scene.World.ptr, LocalID); |
250 | return _position; | 245 | return _position; |
251 | } | 246 | } |
@@ -256,19 +251,19 @@ public class BSCharacter : BSPhysObject | |||
256 | PhysicsScene.TaintedObject("BSCharacter.setPosition", delegate() | 251 | PhysicsScene.TaintedObject("BSCharacter.setPosition", delegate() |
257 | { | 252 | { |
258 | DetailLog("{0},BSCharacter.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); | 253 | DetailLog("{0},BSCharacter.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); |
259 | BulletSimAPI.SetTranslation2(BSBody.ptr, _position, _orientation); | 254 | BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); |
260 | }); | 255 | }); |
261 | } | 256 | } |
262 | } | 257 | } |
263 | public override OMV.Vector3 ForcePosition { | 258 | public override OMV.Vector3 ForcePosition { |
264 | get { | 259 | get { |
265 | _position = BulletSimAPI.GetPosition2(BSBody.ptr); | 260 | _position = BulletSimAPI.GetPosition2(PhysBody.ptr); |
266 | return _position; | 261 | return _position; |
267 | } | 262 | } |
268 | set { | 263 | set { |
269 | _position = value; | 264 | _position = value; |
270 | PositionSanityCheck(); | 265 | PositionSanityCheck(); |
271 | BulletSimAPI.SetTranslation2(BSBody.ptr, _position, _orientation); | 266 | BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); |
272 | } | 267 | } |
273 | } | 268 | } |
274 | 269 | ||
@@ -312,15 +307,11 @@ public class BSCharacter : BSPhysObject | |||
312 | { | 307 | { |
313 | // The new position value must be pushed into the physics engine but we can't | 308 | // The new position value must be pushed into the physics engine but we can't |
314 | // just assign to "Position" because of potential call loops. | 309 | // just assign to "Position" because of potential call loops. |
315 | BSScene.TaintCallback sanityOperation = delegate() | 310 | PhysicsScene.TaintedObject(inTaintTime, "BSCharacter.PositionSanityCheck", delegate() |
316 | { | 311 | { |
317 | DetailLog("{0},BSCharacter.PositionSanityCheck,taint,pos={1},orient={2}", LocalID, _position, _orientation); | 312 | DetailLog("{0},BSCharacter.PositionSanityCheck,taint,pos={1},orient={2}", LocalID, _position, _orientation); |
318 | BulletSimAPI.SetTranslation2(BSBody.ptr, _position, _orientation); | 313 | BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); |
319 | }; | 314 | }); |
320 | if (inTaintTime) | ||
321 | sanityOperation(); | ||
322 | else | ||
323 | PhysicsScene.TaintedObject("BSCharacter.PositionSanityCheck", sanityOperation); | ||
324 | ret = true; | 315 | ret = true; |
325 | } | 316 | } |
326 | return ret; | 317 | return ret; |
@@ -329,7 +320,14 @@ public class BSCharacter : BSPhysObject | |||
329 | public override float Mass { get { return _mass; } } | 320 | public override float Mass { get { return _mass; } } |
330 | 321 | ||
331 | // used when we only want this prim's mass and not the linkset thing | 322 | // used when we only want this prim's mass and not the linkset thing |
332 | public override float MassRaw { get {return _mass; } } | 323 | public override float RawMass { |
324 | get {return _mass; } | ||
325 | } | ||
326 | public override void UpdatePhysicalMassProperties(float physMass) | ||
327 | { | ||
328 | OMV.Vector3 localInertia = BulletSimAPI.CalculateLocalInertia2(PhysShape.ptr, physMass); | ||
329 | BulletSimAPI.SetMassProps2(PhysBody.ptr, physMass, localInertia); | ||
330 | } | ||
333 | 331 | ||
334 | public override OMV.Vector3 Force { | 332 | public override OMV.Vector3 Force { |
335 | get { return _force; } | 333 | get { return _force; } |
@@ -339,7 +337,7 @@ public class BSCharacter : BSPhysObject | |||
339 | PhysicsScene.TaintedObject("BSCharacter.SetForce", delegate() | 337 | PhysicsScene.TaintedObject("BSCharacter.SetForce", delegate() |
340 | { | 338 | { |
341 | DetailLog("{0},BSCharacter.setForce,taint,force={1}", LocalID, _force); | 339 | DetailLog("{0},BSCharacter.setForce,taint,force={1}", LocalID, _force); |
342 | BulletSimAPI.SetObjectForce2(BSBody.ptr, _force); | 340 | BulletSimAPI.SetObjectForce2(PhysBody.ptr, _force); |
343 | }); | 341 | }); |
344 | } | 342 | } |
345 | } | 343 | } |
@@ -378,7 +376,7 @@ public class BSCharacter : BSPhysObject | |||
378 | if (_currentFriction != PhysicsScene.Params.avatarStandingFriction) | 376 | if (_currentFriction != PhysicsScene.Params.avatarStandingFriction) |
379 | { | 377 | { |
380 | _currentFriction = PhysicsScene.Params.avatarStandingFriction; | 378 | _currentFriction = PhysicsScene.Params.avatarStandingFriction; |
381 | BulletSimAPI.SetFriction2(BSBody.ptr, _currentFriction); | 379 | BulletSimAPI.SetFriction2(PhysBody.ptr, _currentFriction); |
382 | } | 380 | } |
383 | } | 381 | } |
384 | else | 382 | else |
@@ -386,15 +384,15 @@ public class BSCharacter : BSPhysObject | |||
386 | if (_currentFriction != PhysicsScene.Params.avatarFriction) | 384 | if (_currentFriction != PhysicsScene.Params.avatarFriction) |
387 | { | 385 | { |
388 | _currentFriction = PhysicsScene.Params.avatarFriction; | 386 | _currentFriction = PhysicsScene.Params.avatarFriction; |
389 | BulletSimAPI.SetFriction2(BSBody.ptr, _currentFriction); | 387 | BulletSimAPI.SetFriction2(PhysBody.ptr, _currentFriction); |
390 | } | 388 | } |
391 | } | 389 | } |
392 | _velocity = value; | 390 | _velocity = value; |
393 | // Remember the set velocity so we can suppress the reduction by friction, ... | 391 | // Remember the set velocity so we can suppress the reduction by friction, ... |
394 | _appliedVelocity = value; | 392 | _appliedVelocity = value; |
395 | 393 | ||
396 | BulletSimAPI.SetLinearVelocity2(BSBody.ptr, _velocity); | 394 | BulletSimAPI.SetLinearVelocity2(PhysBody.ptr, _velocity); |
397 | BulletSimAPI.Activate2(BSBody.ptr, true); | 395 | BulletSimAPI.Activate2(PhysBody.ptr, true); |
398 | } | 396 | } |
399 | } | 397 | } |
400 | public override OMV.Vector3 Torque { | 398 | public override OMV.Vector3 Torque { |
@@ -411,6 +409,11 @@ public class BSCharacter : BSPhysObject | |||
411 | get { return _acceleration; } | 409 | get { return _acceleration; } |
412 | set { _acceleration = value; } | 410 | set { _acceleration = value; } |
413 | } | 411 | } |
412 | public override OMV.Quaternion RawOrientation | ||
413 | { | ||
414 | get { return _orientation; } | ||
415 | set { _orientation = value; } | ||
416 | } | ||
414 | public override OMV.Quaternion Orientation { | 417 | public override OMV.Quaternion Orientation { |
415 | get { return _orientation; } | 418 | get { return _orientation; } |
416 | set { | 419 | set { |
@@ -419,7 +422,7 @@ public class BSCharacter : BSPhysObject | |||
419 | PhysicsScene.TaintedObject("BSCharacter.setOrientation", delegate() | 422 | PhysicsScene.TaintedObject("BSCharacter.setOrientation", delegate() |
420 | { | 423 | { |
421 | // _position = BulletSimAPI.GetPosition2(BSBody.ptr); | 424 | // _position = BulletSimAPI.GetPosition2(BSBody.ptr); |
422 | BulletSimAPI.SetTranslation2(BSBody.ptr, _position, _orientation); | 425 | BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); |
423 | }); | 426 | }); |
424 | } | 427 | } |
425 | } | 428 | } |
@@ -428,13 +431,13 @@ public class BSCharacter : BSPhysObject | |||
428 | { | 431 | { |
429 | get | 432 | get |
430 | { | 433 | { |
431 | _orientation = BulletSimAPI.GetOrientation2(BSBody.ptr); | 434 | _orientation = BulletSimAPI.GetOrientation2(PhysBody.ptr); |
432 | return _orientation; | 435 | return _orientation; |
433 | } | 436 | } |
434 | set | 437 | set |
435 | { | 438 | { |
436 | _orientation = value; | 439 | _orientation = value; |
437 | BulletSimAPI.SetTranslation2(BSBody.ptr, _position, _orientation); | 440 | BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); |
438 | } | 441 | } |
439 | } | 442 | } |
440 | public override int PhysicsActorType { | 443 | public override int PhysicsActorType { |
@@ -493,9 +496,9 @@ public class BSCharacter : BSPhysObject | |||
493 | PhysicsScene.TaintedObject("BSCharacter.setFloatOnWater", delegate() | 496 | PhysicsScene.TaintedObject("BSCharacter.setFloatOnWater", delegate() |
494 | { | 497 | { |
495 | if (_floatOnWater) | 498 | if (_floatOnWater) |
496 | CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(BSBody.ptr, CollisionFlags.BS_FLOATS_ON_WATER); | 499 | CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_FLOATS_ON_WATER); |
497 | else | 500 | else |
498 | CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(BSBody.ptr, CollisionFlags.BS_FLOATS_ON_WATER); | 501 | CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_FLOATS_ON_WATER); |
499 | }); | 502 | }); |
500 | } | 503 | } |
501 | } | 504 | } |
@@ -528,7 +531,7 @@ public class BSCharacter : BSPhysObject | |||
528 | DetailLog("{0},BSCharacter.setForceBuoyancy,taint,buoy={1}", LocalID, _buoyancy); | 531 | DetailLog("{0},BSCharacter.setForceBuoyancy,taint,buoy={1}", LocalID, _buoyancy); |
529 | // Buoyancy is faked by changing the gravity applied to the object | 532 | // Buoyancy is faked by changing the gravity applied to the object |
530 | float grav = PhysicsScene.Params.gravity * (1f - _buoyancy); | 533 | float grav = PhysicsScene.Params.gravity * (1f - _buoyancy); |
531 | BulletSimAPI.SetGravity2(BSBody.ptr, new OMV.Vector3(0f, 0f, grav)); | 534 | BulletSimAPI.SetGravity2(PhysBody.ptr, new OMV.Vector3(0f, 0f, grav)); |
532 | } | 535 | } |
533 | } | 536 | } |
534 | 537 | ||
@@ -574,7 +577,7 @@ public class BSCharacter : BSPhysObject | |||
574 | PhysicsScene.TaintedObject("BSCharacter.AddForce", delegate() | 577 | PhysicsScene.TaintedObject("BSCharacter.AddForce", delegate() |
575 | { | 578 | { |
576 | DetailLog("{0},BSCharacter.setAddForce,taint,addedForce={1}", LocalID, _force); | 579 | DetailLog("{0},BSCharacter.setAddForce,taint,addedForce={1}", LocalID, _force); |
577 | BulletSimAPI.SetObjectForce2(BSBody.ptr, _force); | 580 | BulletSimAPI.SetObjectForce2(PhysBody.ptr, _force); |
578 | }); | 581 | }); |
579 | } | 582 | } |
580 | else | 583 | else |
@@ -642,7 +645,7 @@ public class BSCharacter : BSPhysObject | |||
642 | // That's just the way they are defined. | 645 | // That's just the way they are defined. |
643 | OMV.Vector3 avVel = new OMV.Vector3(_appliedVelocity.X, _appliedVelocity.Y, entprop.Velocity.Z); | 646 | OMV.Vector3 avVel = new OMV.Vector3(_appliedVelocity.X, _appliedVelocity.Y, entprop.Velocity.Z); |
644 | _velocity = avVel; | 647 | _velocity = avVel; |
645 | BulletSimAPI.SetLinearVelocity2(BSBody.ptr, avVel); | 648 | BulletSimAPI.SetLinearVelocity2(PhysBody.ptr, avVel); |
646 | } | 649 | } |
647 | 650 | ||
648 | // Tell the linkset about value changes | 651 | // Tell the linkset about value changes |