aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorRobert Adams2012-12-09 22:10:32 -0800
committerRobert Adams2012-12-09 22:32:46 -0800
commitce5083a504a82712149f5e3dab622d42e260bba3 (patch)
tree37c54b8649e07ed227a947208ddad0f7bfa79043 /OpenSim/Region
parentHGAssetMapper: Get wasn't really working. It's true that some assets are copi... (diff)
downloadopensim-SC_OLD-ce5083a504a82712149f5e3dab622d42e260bba3.zip
opensim-SC_OLD-ce5083a504a82712149f5e3dab622d42e260bba3.tar.gz
opensim-SC_OLD-ce5083a504a82712149f5e3dab622d42e260bba3.tar.bz2
opensim-SC_OLD-ce5083a504a82712149f5e3dab622d42e260bba3.tar.xz
BulletSim: adjust friction and restitution based on material type.
Diffstat (limited to 'OpenSim/Region')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs10
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs12
2 files changed, 17 insertions, 5 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
index f6a890e..b05d4ee 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
@@ -60,6 +60,9 @@ public abstract class BSPhysObject : PhysicsActor
60 Linkset = BSLinkset.Factory(PhysicsScene, this); 60 Linkset = BSLinkset.Factory(PhysicsScene, this);
61 LastAssetBuildFailed = false; 61 LastAssetBuildFailed = false;
62 62
63 // Default material type
64 Material = MaterialAttributes.Material.Wood;
65
63 CollisionCollection = new CollisionEventUpdate(); 66 CollisionCollection = new CollisionEventUpdate();
64 SubscribedEventsMs = 0; 67 SubscribedEventsMs = 0;
65 CollidingStep = 0; 68 CollidingStep = 0;
@@ -109,6 +112,13 @@ public abstract class BSPhysObject : PhysicsActor
109 public abstract bool IsSolid { get; } 112 public abstract bool IsSolid { get; }
110 public abstract bool IsStatic { get; } 113 public abstract bool IsStatic { get; }
111 114
115 // Materialness
116 public MaterialAttributes.Material Material { get; private set; }
117 public override void SetMaterial(int material)
118 {
119 Material = (MaterialAttributes.Material)material;
120 }
121
112 // Stop all physical motion. 122 // Stop all physical motion.
113 public abstract void ZeroMotion(bool inTaintTime); 123 public abstract void ZeroMotion(bool inTaintTime);
114 public abstract void ZeroAngularMotion(bool inTaintTime); 124 public abstract void ZeroAngularMotion(bool inTaintTime);
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 4d203ff..627393a 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -683,8 +683,9 @@ public sealed class BSPrim : BSPhysObject
683 ZeroMotion(true); 683 ZeroMotion(true);
684 684
685 // Set various physical properties so other object interact properly 685 // Set various physical properties so other object interact properly
686 BulletSimAPI.SetFriction2(PhysBody.ptr, PhysicsScene.Params.defaultFriction); 686 MaterialAttributes matAttrib = BSMaterials.GetAttributes(Material, false);
687 BulletSimAPI.SetRestitution2(PhysBody.ptr, PhysicsScene.Params.defaultRestitution); 687 BulletSimAPI.SetFriction2(PhysBody.ptr, matAttrib.friction);
688 BulletSimAPI.SetRestitution2(PhysBody.ptr, matAttrib.restitution);
688 689
689 // Mass is zero which disables a bunch of physics stuff in Bullet 690 // Mass is zero which disables a bunch of physics stuff in Bullet
690 UpdatePhysicalMassProperties(0f); 691 UpdatePhysicalMassProperties(0f);
@@ -711,9 +712,10 @@ public sealed class BSPrim : BSPhysObject
711 // Not a Bullet static object 712 // Not a Bullet static object
712 CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(PhysBody.ptr, CollisionFlags.CF_STATIC_OBJECT); 713 CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(PhysBody.ptr, CollisionFlags.CF_STATIC_OBJECT);
713 714
714 // Set various physical properties so internal dynamic properties will get computed correctly as they are set 715 // Set various physical properties so other object interact properly
715 BulletSimAPI.SetFriction2(PhysBody.ptr, PhysicsScene.Params.defaultFriction); 716 MaterialAttributes matAttrib = BSMaterials.GetAttributes(Material, true);
716 BulletSimAPI.SetRestitution2(PhysBody.ptr, PhysicsScene.Params.defaultRestitution); 717 BulletSimAPI.SetFriction2(PhysBody.ptr, matAttrib.friction);
718 BulletSimAPI.SetRestitution2(PhysBody.ptr, matAttrib.restitution);
717 719
718 // per http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=3382 720 // per http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=3382
719 // Since this can be called multiple times, only zero forces when becoming physical 721 // Since this can be called multiple times, only zero forces when becoming physical