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.cs17
1 files changed, 12 insertions, 5 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
index ec25aa9..0b35f3a 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 GravityModifier = 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,16 @@ 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 MaterialAttributes matAttrib = BSMaterials.GetAttributes(Material, false);
174 Friction = matAttrib.friction;
175 Restitution = matAttrib.restitution;
176 Density = matAttrib.density;
167 } 177 }
168 178
169 // Stop all physical motion. 179 // Stop all physical motion.
170 public abstract void ZeroMotion(bool inTaintTime); 180 public abstract void ZeroMotion(bool inTaintTime);
171 public abstract void ZeroAngularMotion(bool inTaintTime); 181 public abstract void ZeroAngularMotion(bool inTaintTime);
172 182
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. 183 // Update the physical location and motion of the object. Called with data from Bullet.
177 public abstract void UpdateProperties(EntityProperties entprop); 184 public abstract void UpdateProperties(EntityProperties entprop);
178 185