diff options
author | Robert Adams | 2013-01-31 10:26:53 -0800 |
---|---|---|
committer | Robert Adams | 2013-01-31 15:56:02 -0800 |
commit | ed71c939fc22059b03572fe6380fcc754c89a284 (patch) | |
tree | b10e0be30b391e0e90c855f4cf671fa42d4faf16 | |
parent | BulletSim: clean up TargetVelocity implementation by using the default defn i... (diff) | |
download | opensim-SC_OLD-ed71c939fc22059b03572fe6380fcc754c89a284.zip opensim-SC_OLD-ed71c939fc22059b03572fe6380fcc754c89a284.tar.gz opensim-SC_OLD-ed71c939fc22059b03572fe6380fcc754c89a284.tar.bz2 opensim-SC_OLD-ed71c939fc22059b03572fe6380fcc754c89a284.tar.xz |
BulletSim: make sure vehicle physical properties are set when going
physical by delaying setting until pre-step time. Change vehicle.Refresh()
to schedule the pre-step setting.
Comments and updating of TODO list.
Diffstat (limited to '')
5 files changed, 35 insertions, 46 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index 05ab180..8ecf2ff 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |||
@@ -581,9 +581,18 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
581 | } | 581 | } |
582 | #endregion // Vehicle parameter setting | 582 | #endregion // Vehicle parameter setting |
583 | 583 | ||
584 | public void Refresh() | ||
585 | { | ||
586 | // If asking for a refresh, reset the physical parameters before the next simulation step. | ||
587 | PhysicsScene.PostTaintObject("BSDynamics.Refresh", Prim.LocalID, delegate() | ||
588 | { | ||
589 | SetPhysicalParameters(); | ||
590 | }); | ||
591 | } | ||
592 | |||
584 | // Some of the properties of this prim may have changed. | 593 | // Some of the properties of this prim may have changed. |
585 | // Do any updating needed for a vehicle | 594 | // Do any updating needed for a vehicle |
586 | public void Refresh() | 595 | private void SetPhysicalParameters() |
587 | { | 596 | { |
588 | if (IsActive) | 597 | if (IsActive) |
589 | { | 598 | { |
@@ -614,7 +623,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
614 | // The actual vehicle gravity is set to zero in Bullet so we can do all the application of same. | 623 | // The actual vehicle gravity is set to zero in Bullet so we can do all the application of same. |
615 | PhysicsScene.PE.SetGravity(Prim.PhysBody, Vector3.Zero); | 624 | PhysicsScene.PE.SetGravity(Prim.PhysBody, Vector3.Zero); |
616 | 625 | ||
617 | VDetailLog("{0},BSDynamics.Refresh,mass={1},inert={2},grav={3},aDamp={4},frict={5},rest={6},lFact={7},aFact={8}", | 626 | VDetailLog("{0},BSDynamics.SetPhysicalParameters,mass={1},inert={2},vehGrav={3},aDamp={4},frict={5},rest={6},lFact={7},aFact={8}", |
618 | Prim.LocalID, m_vehicleMass, Prim.Inertia, m_VehicleGravity, | 627 | Prim.LocalID, m_vehicleMass, Prim.Inertia, m_VehicleGravity, |
619 | BSParam.VehicleAngularDamping, BSParam.VehicleFriction, BSParam.VehicleRestitution, | 628 | BSParam.VehicleAngularDamping, BSParam.VehicleFriction, BSParam.VehicleRestitution, |
620 | BSParam.VehicleLinearFactor, BSParam.VehicleAngularFactor | 629 | BSParam.VehicleLinearFactor, BSParam.VehicleAngularFactor |
@@ -622,26 +631,15 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
622 | } | 631 | } |
623 | else | 632 | else |
624 | { | 633 | { |
625 | PhysicsScene.PE.RemoveFromCollisionFlags(Prim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS); | 634 | if (Prim.PhysBody.HasPhysicalBody) |
635 | PhysicsScene.PE.RemoveFromCollisionFlags(Prim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS); | ||
626 | } | 636 | } |
627 | } | 637 | } |
628 | 638 | ||
629 | public bool RemoveBodyDependencies(BSPhysObject prim) | 639 | public bool RemoveBodyDependencies(BSPhysObject prim) |
630 | { | 640 | { |
631 | // If active, we need to add our properties back when the body is rebuilt. | ||
632 | return IsActive; | ||
633 | } | ||
634 | |||
635 | public void RestoreBodyDependencies(BSPhysObject prim) | ||
636 | { | ||
637 | if (Prim.LocalID != prim.LocalID) | ||
638 | { | ||
639 | // The call should be on us by our prim. Error if not. | ||
640 | PhysicsScene.Logger.ErrorFormat("{0} RestoreBodyDependencies: called by not my prim. passedLocalID={1}, vehiclePrimLocalID={2}", | ||
641 | LogHeader, prim.LocalID, Prim.LocalID); | ||
642 | return; | ||
643 | } | ||
644 | Refresh(); | 641 | Refresh(); |
642 | return IsActive; | ||
645 | } | 643 | } |
646 | 644 | ||
647 | #region Known vehicle value functions | 645 | #region Known vehicle value functions |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs index 54dc458..92f6ee2 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | |||
@@ -274,7 +274,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
274 | bool ret = false; | 274 | bool ret = false; |
275 | 275 | ||
276 | DetailLog("{0},BSLinksetCompound.RemoveBodyDependencies,refreshIfChild,rID={1},rBody={2},isRoot={3}", | 276 | DetailLog("{0},BSLinksetCompound.RemoveBodyDependencies,refreshIfChild,rID={1},rBody={2},isRoot={3}", |
277 | child.LocalID, LinksetRoot.LocalID, LinksetRoot.PhysBody.AddrString, IsRoot(child)); | 277 | child.LocalID, LinksetRoot.LocalID, LinksetRoot.PhysBody, IsRoot(child)); |
278 | 278 | ||
279 | if (!IsRoot(child)) | 279 | if (!IsRoot(child)) |
280 | { | 280 | { |
@@ -382,11 +382,11 @@ public sealed class BSLinksetCompound : BSLinkset | |||
382 | { | 382 | { |
383 | try | 383 | try |
384 | { | 384 | { |
385 | // Suppress rebuilding while rebuilding | 385 | // Suppress rebuilding while rebuilding. (We know rebuilding is on only one thread.) |
386 | Rebuilding = true; | 386 | Rebuilding = true; |
387 | 387 | ||
388 | // Cause the root shape to be rebuilt as a compound object with just the root in it | 388 | // Cause the root shape to be rebuilt as a compound object with just the root in it |
389 | LinksetRoot.ForceBodyShapeRebuild(true); | 389 | LinksetRoot.ForceBodyShapeRebuild(true /* inTaintTime */); |
390 | 390 | ||
391 | // The center of mass for the linkset is the geometric center of the group. | 391 | // The center of mass for the linkset is the geometric center of the group. |
392 | // Compute a displacement for each component so it is relative to the center-of-mass. | 392 | // Compute a displacement for each component so it is relative to the center-of-mass. |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index b5dd131..0b81122 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -1597,9 +1597,9 @@ public sealed class BSPrim : BSPhysObject | |||
1597 | public void CreateGeomAndObject(bool forceRebuild) | 1597 | public void CreateGeomAndObject(bool forceRebuild) |
1598 | { | 1598 | { |
1599 | // Create the correct physical representation for this type of object. | 1599 | // Create the correct physical representation for this type of object. |
1600 | // Updates PhysBody and PhysShape with the new information. | 1600 | // Updates base.PhysBody and base.PhysShape with the new information. |
1601 | // Ignore 'forceRebuild'. This routine makes the right choices and changes of necessary. | 1601 | // Ignore 'forceRebuild'. This routine makes the right choices and changes of necessary. |
1602 | PhysicsScene.Shapes.GetBodyAndShape(false, PhysicsScene.World, this, null, delegate(BulletBody dBody) | 1602 | PhysicsScene.Shapes.GetBodyAndShape(false /*forceRebuild */, PhysicsScene.World, this, null, delegate(BulletBody dBody) |
1603 | { | 1603 | { |
1604 | // Called if the current prim body is about to be destroyed. | 1604 | // Called if the current prim body is about to be destroyed. |
1605 | // Remove all the physical dependencies on the old body. | 1605 | // Remove all the physical dependencies on the old body. |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs index 9fbfcdc..e2daa72 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | |||
@@ -116,8 +116,7 @@ public sealed class BSShapeCollection : IDisposable | |||
116 | // rebuild the body around it. | 116 | // rebuild the body around it. |
117 | // Updates prim.BSBody with information/pointers to requested body | 117 | // Updates prim.BSBody with information/pointers to requested body |
118 | // Returns 'true' if BSBody was changed. | 118 | // Returns 'true' if BSBody was changed. |
119 | bool newBody = CreateBody((newGeom || forceRebuild), prim, PhysicsScene.World, | 119 | bool newBody = CreateBody((newGeom || forceRebuild), prim, PhysicsScene.World, bodyCallback); |
120 | prim.PhysShape, bodyCallback); | ||
121 | ret = newGeom || newBody; | 120 | ret = newGeom || newBody; |
122 | } | 121 | } |
123 | DetailLog("{0},BSShapeCollection.GetBodyAndShape,taintExit,force={1},ret={2},body={3},shape={4}", | 122 | DetailLog("{0},BSShapeCollection.GetBodyAndShape,taintExit,force={1},ret={2},body={3},shape={4}", |
@@ -933,8 +932,7 @@ public sealed class BSShapeCollection : IDisposable | |||
933 | // Updates prim.BSBody with the information about the new body if one is created. | 932 | // Updates prim.BSBody with the information about the new body if one is created. |
934 | // Returns 'true' if an object was actually created. | 933 | // Returns 'true' if an object was actually created. |
935 | // Called at taint-time. | 934 | // Called at taint-time. |
936 | private bool CreateBody(bool forceRebuild, BSPhysObject prim, BulletWorld sim, BulletShape shape, | 935 | private bool CreateBody(bool forceRebuild, BSPhysObject prim, BulletWorld sim, BodyDestructionCallback bodyCallback) |
937 | BodyDestructionCallback bodyCallback) | ||
938 | { | 936 | { |
939 | bool ret = false; | 937 | bool ret = false; |
940 | 938 | ||
@@ -951,6 +949,7 @@ public sealed class BSShapeCollection : IDisposable | |||
951 | { | 949 | { |
952 | // If the collisionObject is not the correct type for solidness, rebuild what's there | 950 | // If the collisionObject is not the correct type for solidness, rebuild what's there |
953 | mustRebuild = true; | 951 | mustRebuild = true; |
952 | if (DDetail) DetailLog("{0},BSShapeCollection.CreateBody,forceRebuildBecauseChangingBodyType,bodyType={1}", prim.LocalID, bodyType); | ||
954 | } | 953 | } |
955 | } | 954 | } |
956 | 955 | ||
@@ -962,12 +961,12 @@ public sealed class BSShapeCollection : IDisposable | |||
962 | BulletBody aBody; | 961 | BulletBody aBody; |
963 | if (prim.IsSolid) | 962 | if (prim.IsSolid) |
964 | { | 963 | { |
965 | aBody = PhysicsScene.PE.CreateBodyFromShape(sim, shape, prim.LocalID, prim.RawPosition, prim.RawOrientation); | 964 | aBody = PhysicsScene.PE.CreateBodyFromShape(sim, prim.PhysShape, prim.LocalID, prim.RawPosition, prim.RawOrientation); |
966 | if (DDetail) DetailLog("{0},BSShapeCollection.CreateBody,mesh,body={1}", prim.LocalID, aBody); | 965 | if (DDetail) DetailLog("{0},BSShapeCollection.CreateBody,mesh,body={1}", prim.LocalID, aBody); |
967 | } | 966 | } |
968 | else | 967 | else |
969 | { | 968 | { |
970 | aBody = PhysicsScene.PE.CreateGhostFromShape(sim, shape, prim.LocalID, prim.RawPosition, prim.RawOrientation); | 969 | aBody = PhysicsScene.PE.CreateGhostFromShape(sim, prim.PhysShape, prim.LocalID, prim.RawPosition, prim.RawOrientation); |
971 | if (DDetail) DetailLog("{0},BSShapeCollection.CreateBody,ghost,body={1}", prim.LocalID, aBody); | 970 | if (DDetail) DetailLog("{0},BSShapeCollection.CreateBody,ghost,body={1}", prim.LocalID, aBody); |
972 | } | 971 | } |
973 | 972 | ||
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt index a95e169..d574a49 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt | |||
@@ -6,6 +6,7 @@ One sided meshes? Should terrain be built into a closed shape? | |||
6 | Ref: http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4869 | 6 | Ref: http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4869 |
7 | Deleting a linkset while standing on the root will leave the physical shape of the root behind. | 7 | Deleting a linkset while standing on the root will leave the physical shape of the root behind. |
8 | Not sure if it is because standing on it. Done with large prim linksets. | 8 | Not sure if it is because standing on it. Done with large prim linksets. |
9 | Terrain detail: double terrain mesh detail | ||
9 | Vehicle angular vertical attraction | 10 | Vehicle angular vertical attraction |
10 | vehicle angular banking | 11 | vehicle angular banking |
11 | Center-of-gravity | 12 | Center-of-gravity |
@@ -34,34 +35,20 @@ Vehicle script tuning/debugging | |||
34 | Weapon shooter script | 35 | Weapon shooter script |
35 | Add material densities to the material types | 36 | Add material densities to the material types |
36 | 37 | ||
37 | CRASHES | ||
38 | ================================================= | ||
39 | Crazyness during 20130115 office hours was PositionAdjustUnderground for both char and prim | ||
40 | m1:logs/20130115.0934/physics-BulletSim-20130115083613.log | ||
41 | Creation of Neb's terrain made the terrain "disappear". Everything started to fall | ||
42 | and then get restored to be above terrain. | ||
43 | 20121129.1411: editting/moving phys object across region boundries causes crash | ||
44 | getPos-> btRigidBody::upcast -> getBodyType -> BOOM | ||
45 | 20121128.1600: mesh object not rezzing (no physics mesh). | ||
46 | Causes many errors. Doesn't stop after first error with box shape. | ||
47 | Eventually crashes when deleting the object. | ||
48 | 20121206.1434: rez Sam-pan into OSGrid BulletSim11 region | ||
49 | Immediate simulator crash. Mono does not output any stacktrace and | ||
50 | log just stops after reporting taint-time linking of the linkset. | ||
51 | |||
52 | VEHICLES TODO LIST: | 38 | VEHICLES TODO LIST: |
53 | ================================================= | 39 | ================================================= |
54 | Border crossing with linked vehicle causes crash | 40 | Border crossing with linked vehicle causes crash |
41 | 20121129.1411: editting/moving phys object across region boundries causes crash | ||
42 | getPos-> btRigidBody::upcast -> getBodyType -> BOOM | ||
55 | Vehicles (Move smoothly) | 43 | Vehicles (Move smoothly) |
56 | Some vehicles should not be able to turn if no speed or off ground. | 44 | Some vehicles should not be able to turn if no speed or off ground. |
45 | What to do if vehicle and prim buoyancy differ? | ||
57 | Cannot edit/move a vehicle being ridden: it jumps back to the origional position. | 46 | Cannot edit/move a vehicle being ridden: it jumps back to the origional position. |
58 | Neb car jiggling left and right | 47 | Neb car jiggling left and right |
59 | Happens on terrain and any other mesh object. Flat cubes are much smoother. | 48 | Happens on terrain and any other mesh object. Flat cubes are much smoother. |
60 | This has been reduced but not eliminated. | 49 | This has been reduced but not eliminated. |
61 | Implement referenceFrame for all the motion routines. | 50 | Implement referenceFrame for all the motion routines. |
62 | For limitMotorUp, use raycast down to find if vehicle is in the air. | 51 | For limitMotorUp, use raycast down to find if vehicle is in the air. |
63 | Angular motion around Z moves the vehicle in world Z and not vehicle Z in ODE. | ||
64 | Verify that angular motion specified around Z moves in the vehicle coordinates. | ||
65 | Verify llGetVel() is returning a smooth and good value for vehicle movement. | 52 | Verify llGetVel() is returning a smooth and good value for vehicle movement. |
66 | llGetVel() should return the root's velocity if requested in a child prim. | 53 | llGetVel() should return the root's velocity if requested in a child prim. |
67 | Implement function efficiency for lineaar and angular motion. | 54 | Implement function efficiency for lineaar and angular motion. |
@@ -73,10 +60,11 @@ Remove vehicle angular velocity zeroing in BSPrim.UpdateProperties(). | |||
73 | Incorporate inter-relationship of angular corrections. For instance, angularDeflection | 60 | Incorporate inter-relationship of angular corrections. For instance, angularDeflection |
74 | and angularMotorUp will compute same X or Y correction. When added together | 61 | and angularMotorUp will compute same X or Y correction. When added together |
75 | creates over-correction and over-shoot and wabbling. | 62 | creates over-correction and over-shoot and wabbling. |
63 | Vehicle attributes are not restored when a vehicle is rezzed on region creation | ||
64 | Create vehicle, setup vehicle properties, restart region, vehicle is not reinitialized. | ||
76 | 65 | ||
77 | GENERAL TODO LIST: | 66 | GENERAL TODO LIST: |
78 | ================================================= | 67 | ================================================= |
79 | Avatar standing on a moving object should start to move with the object. | ||
80 | llMoveToTarget objects are not effected by gravity until target is removed. | 68 | llMoveToTarget objects are not effected by gravity until target is removed. |
81 | Compute CCD parameters based on body size | 69 | Compute CCD parameters based on body size |
82 | Can solver iterations be changed per body/shape? Can be for constraints but what | 70 | Can solver iterations be changed per body/shape? Can be for constraints but what |
@@ -330,4 +318,8 @@ Boats float low in the water (DONE) | |||
330 | Boats floating at proper level (DONE) | 318 | Boats floating at proper level (DONE) |
331 | When is force introduced by SetForce removed? The prestep action could go forever. (DONE) | 319 | When is force introduced by SetForce removed? The prestep action could go forever. (DONE) |
332 | (Resolution: setForce registers a prestep action which keeps applying the force) | 320 | (Resolution: setForce registers a prestep action which keeps applying the force) |
333 | Child movement in linkset (don't rebuild linkset) (DONE 20130122)) \ No newline at end of file | 321 | Child movement in linkset (don't rebuild linkset) (DONE 20130122)) |
322 | Avatar standing on a moving object should start to move with the object. (DONE 20130125) | ||
323 | Angular motion around Z moves the vehicle in world Z and not vehicle Z in ODE. | ||
324 | Verify that angular motion specified around Z moves in the vehicle coordinates. | ||
325 | DONE 20130120: BulletSim properly applies force in vehicle relative coordinates. \ No newline at end of file | ||