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.cs19
1 files changed, 14 insertions, 5 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
index ec25aa9..0d8bb03 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
@@ -78,6 +78,10 @@ public abstract class BSPhysObject : PhysicsActor
78 Name = name; // PhysicsActor also has the name of the object. Someday consolidate. 78 Name = name; // PhysicsActor also has the name of the object. Someday consolidate.
79 TypeName = typeName; 79 TypeName = typeName;
80 80
81 // Initialize variables kept in base.
82 GravModifier = 1.0f;
83 Gravity = new OMV.Vector3(0f, 0f, BSParam.Gravity);
84
81 // We don't have any physical representation yet. 85 // We don't have any physical representation yet.
82 PhysBody = new BulletBody(localID); 86 PhysBody = new BulletBody(localID);
83 PhysShape = new BulletShape(); 87 PhysShape = new BulletShape();
@@ -88,8 +92,8 @@ public abstract class BSPhysObject : PhysicsActor
88 92
89 LastAssetBuildFailed = false; 93 LastAssetBuildFailed = false;
90 94
91 // Default material type 95 // Default material type. Also sets Friction, Restitution and Density.
92 Material = MaterialAttributes.Material.Wood; 96 SetMaterial((int)MaterialAttributes.Material.Wood);
93 97
94 CollisionCollection = new CollisionEventUpdate(); 98 CollisionCollection = new CollisionEventUpdate();
95 CollisionsLastTick = CollisionCollection; 99 CollisionsLastTick = CollisionCollection;
@@ -122,6 +126,8 @@ public abstract class BSPhysObject : PhysicsActor
122 // 'inWorld' true if the object has already been added to the dynamic world. 126 // 'inWorld' true if the object has already been added to the dynamic world.
123 public abstract void UpdatePhysicalMassProperties(float mass, bool inWorld); 127 public abstract void UpdatePhysicalMassProperties(float mass, bool inWorld);
124 128
129 // The gravity being applied to the object. A function of default grav, GravityModifier and Buoyancy.
130 public virtual OMV.Vector3 Gravity { get; set; }
125 // The last value calculated for the prim's inertia 131 // The last value calculated for the prim's inertia
126 public OMV.Vector3 Inertia { get; set; } 132 public OMV.Vector3 Inertia { get; set; }
127 133
@@ -164,15 +170,18 @@ public abstract class BSPhysObject : PhysicsActor
164 public override void SetMaterial(int material) 170 public override void SetMaterial(int material)
165 { 171 {
166 Material = (MaterialAttributes.Material)material; 172 Material = (MaterialAttributes.Material)material;
173
174 // Setting the material sets the material attributes also.
175 MaterialAttributes matAttrib = BSMaterials.GetAttributes(Material, false);
176 Friction = matAttrib.friction;
177 Restitution = matAttrib.restitution;
178 Density = matAttrib.density;
167 } 179 }
168 180
169 // Stop all physical motion. 181 // Stop all physical motion.
170 public abstract void ZeroMotion(bool inTaintTime); 182 public abstract void ZeroMotion(bool inTaintTime);
171 public abstract void ZeroAngularMotion(bool inTaintTime); 183 public abstract void ZeroAngularMotion(bool inTaintTime);
172 184
173 // Step the vehicle simulation for this object. A NOOP if the vehicle was not configured.
174 public virtual void StepVehicle(float timeStep) { }
175
176 // Update the physical location and motion of the object. Called with data from Bullet. 185 // Update the physical location and motion of the object. Called with data from Bullet.
177 public abstract void UpdateProperties(EntityProperties entprop); 186 public abstract void UpdateProperties(EntityProperties entprop);
178 187