aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BasicPhysicsPlugin
diff options
context:
space:
mode:
authorJohn Hurliman2009-10-25 23:16:12 -0700
committerJohn Hurliman2009-10-26 18:23:43 -0700
commitd199767e6991d6f368661fce9c5a072e564b8a4b (patch)
treed9347b8a424c0164e208f908613aa8fe1511444b /OpenSim/Region/Physics/BasicPhysicsPlugin
parent* Double the priority on avatar bake texture requests to get avatars rezzing ... (diff)
downloadopensim-SC_OLD-d199767e6991d6f368661fce9c5a072e564b8a4b.zip
opensim-SC_OLD-d199767e6991d6f368661fce9c5a072e564b8a4b.tar.gz
opensim-SC_OLD-d199767e6991d6f368661fce9c5a072e564b8a4b.tar.bz2
opensim-SC_OLD-d199767e6991d6f368661fce9c5a072e564b8a4b.tar.xz
Experimental change of PhysicsVector to Vector3. Untested
Diffstat (limited to 'OpenSim/Region/Physics/BasicPhysicsPlugin')
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs54
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs40
2 files changed, 48 insertions, 46 deletions
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
index 8d8b3fe..8df997e 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
@@ -36,20 +36,16 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
36{ 36{
37 public class BasicActor : PhysicsActor 37 public class BasicActor : PhysicsActor
38 { 38 {
39 private PhysicsVector _position; 39 private Vector3 _position;
40 private PhysicsVector _velocity; 40 private Vector3 _velocity;
41 private PhysicsVector _acceleration; 41 private Vector3 _acceleration;
42 private PhysicsVector _size; 42 private Vector3 _size;
43 private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero; 43 private Vector3 m_rotationalVelocity;
44 private bool flying; 44 private bool flying;
45 private bool iscolliding; 45 private bool iscolliding;
46 46
47 public BasicActor() 47 public BasicActor()
48 { 48 {
49 _velocity = new PhysicsVector();
50 _position = new PhysicsVector();
51 _acceleration = new PhysicsVector();
52 _size = new PhysicsVector();
53 } 49 }
54 50
55 public override int PhysicsActorType 51 public override int PhysicsActorType
@@ -58,7 +54,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
58 set { return; } 54 set { return; }
59 } 55 }
60 56
61 public override PhysicsVector RotationalVelocity 57 public override Vector3 RotationalVelocity
62 { 58 {
63 get { return m_rotationalVelocity; } 59 get { return m_rotationalVelocity; }
64 set { m_rotationalVelocity = value; } 60 set { m_rotationalVelocity = value; }
@@ -137,13 +133,13 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
137 get { return false; } 133 get { return false; }
138 } 134 }
139 135
140 public override PhysicsVector Position 136 public override Vector3 Position
141 { 137 {
142 get { return _position; } 138 get { return _position; }
143 set { _position = value; } 139 set { _position = value; }
144 } 140 }
145 141
146 public override PhysicsVector Size 142 public override Vector3 Size
147 { 143 {
148 get { return _size; } 144 get { return _size; }
149 set { 145 set {
@@ -162,9 +158,9 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
162 get { return 0f; } 158 get { return 0f; }
163 } 159 }
164 160
165 public override PhysicsVector Force 161 public override Vector3 Force
166 { 162 {
167 get { return PhysicsVector.Zero; } 163 get { return Vector3.Zero; }
168 set { return; } 164 set { return; }
169 } 165 }
170 166
@@ -179,7 +175,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
179 175
180 } 176 }
181 177
182 public override void VehicleVectorParam(int param, PhysicsVector value) 178 public override void VehicleVectorParam(int param, Vector3 value)
183 { 179 {
184 180
185 } 181 }
@@ -194,25 +190,25 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
194 190
195 } 191 }
196 192
197 public override PhysicsVector CenterOfMass 193 public override Vector3 CenterOfMass
198 { 194 {
199 get { return PhysicsVector.Zero; } 195 get { return Vector3.Zero; }
200 } 196 }
201 197
202 public override PhysicsVector GeometricCenter 198 public override Vector3 GeometricCenter
203 { 199 {
204 get { return PhysicsVector.Zero; } 200 get { return Vector3.Zero; }
205 } 201 }
206 202
207 public override PhysicsVector Velocity 203 public override Vector3 Velocity
208 { 204 {
209 get { return _velocity; } 205 get { return _velocity; }
210 set { _velocity = value; } 206 set { _velocity = value; }
211 } 207 }
212 208
213 public override PhysicsVector Torque 209 public override Vector3 Torque
214 { 210 {
215 get { return PhysicsVector.Zero; } 211 get { return Vector3.Zero; }
216 set { return; } 212 set { return; }
217 } 213 }
218 214
@@ -228,7 +224,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
228 set { } 224 set { }
229 } 225 }
230 226
231 public override PhysicsVector Acceleration 227 public override Vector3 Acceleration
232 { 228 {
233 get { return _acceleration; } 229 get { return _acceleration; }
234 } 230 }
@@ -247,24 +243,24 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
247 { 243 {
248 } 244 }
249 245
250 public override void LockAngularMotion(PhysicsVector axis) 246 public override void LockAngularMotion(Vector3 axis)
251 { 247 {
252 } 248 }
253 249
254 public void SetAcceleration(PhysicsVector accel) 250 public void SetAcceleration(Vector3 accel)
255 { 251 {
256 _acceleration = accel; 252 _acceleration = accel;
257 } 253 }
258 254
259 public override void AddForce(PhysicsVector force, bool pushforce) 255 public override void AddForce(Vector3 force, bool pushforce)
260 { 256 {
261 } 257 }
262 258
263 public override void AddAngularForce(PhysicsVector force, bool pushforce) 259 public override void AddAngularForce(Vector3 force, bool pushforce)
264 { 260 {
265 } 261 }
266 262
267 public override void SetMomentum(PhysicsVector momentum) 263 public override void SetMomentum(Vector3 momentum)
268 { 264 {
269 } 265 }
270 266
@@ -272,7 +268,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
272 { 268 {
273 } 269 }
274 270
275 public override PhysicsVector PIDTarget 271 public override Vector3 PIDTarget
276 { 272 {
277 set { return; } 273 set { return; }
278 } 274 }
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
index 66bd099..b6e1cb4 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
@@ -54,7 +54,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
54 { 54 {
55 55
56 } 56 }
57 public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying) 57 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
58 { 58 {
59 BasicActor act = new BasicActor(); 59 BasicActor act = new BasicActor();
60 act.Position = position; 60 act.Position = position;
@@ -77,20 +77,20 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
77 } 77 }
78 78
79/* 79/*
80 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation) 80 public override PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation)
81 { 81 {
82 return null; 82 return null;
83 } 83 }
84*/ 84*/
85 85
86 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, 86 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
87 PhysicsVector size, Quaternion rotation) 87 Vector3 size, Quaternion rotation)
88 { 88 {
89 return AddPrimShape(primName, pbs, position, size, rotation, false); 89 return AddPrimShape(primName, pbs, position, size, rotation, false);
90 } 90 }
91 91
92 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, 92 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
93 PhysicsVector size, Quaternion rotation, bool isPhysical) 93 Vector3 size, Quaternion rotation, bool isPhysical)
94 { 94 {
95 return null; 95 return null;
96 } 96 }
@@ -105,26 +105,28 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
105 for (int i = 0; i < _actors.Count; ++i) 105 for (int i = 0; i < _actors.Count; ++i)
106 { 106 {
107 BasicActor actor = _actors[i]; 107 BasicActor actor = _actors[i];
108 Vector3 actorPosition = actor.Position;
109 Vector3 actorVelocity = actor.Velocity;
108 110
109 actor.Position.X += actor.Velocity.X*timeStep; 111 actorPosition.X += actor.Velocity.X*timeStep;
110 actor.Position.Y += actor.Velocity.Y*timeStep; 112 actorPosition.Y += actor.Velocity.Y*timeStep;
111 113
112 if (actor.Position.Y < 0) 114 if (actor.Position.Y < 0)
113 { 115 {
114 actor.Position.Y = 0.1F; 116 actorPosition.Y = 0.1F;
115 } 117 }
116 else if (actor.Position.Y >= Constants.RegionSize) 118 else if (actor.Position.Y >= Constants.RegionSize)
117 { 119 {
118 actor.Position.Y = ((int)Constants.RegionSize - 0.1f); 120 actorPosition.Y = ((int)Constants.RegionSize - 0.1f);
119 } 121 }
120 122
121 if (actor.Position.X < 0) 123 if (actor.Position.X < 0)
122 { 124 {
123 actor.Position.X = 0.1F; 125 actorPosition.X = 0.1F;
124 } 126 }
125 else if (actor.Position.X >= Constants.RegionSize) 127 else if (actor.Position.X >= Constants.RegionSize)
126 { 128 {
127 actor.Position.X = ((int)Constants.RegionSize - 0.1f); 129 actorPosition.X = ((int)Constants.RegionSize - 0.1f);
128 } 130 }
129 131
130 float height = _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + actor.Size.Z; 132 float height = _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + actor.Size.Z;
@@ -133,23 +135,27 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
133 if (actor.Position.Z + (actor.Velocity.Z*timeStep) < 135 if (actor.Position.Z + (actor.Velocity.Z*timeStep) <
134 _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + 2) 136 _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + 2)
135 { 137 {
136 actor.Position.Z = height; 138 actorPosition.Z = height;
137 actor.Velocity.Z = 0; 139 actorVelocity.Z = 0;
138 actor.IsColliding = true; 140 actor.IsColliding = true;
139 } 141 }
140 else 142 else
141 { 143 {
142 actor.Position.Z += actor.Velocity.Z*timeStep; 144 actorPosition.Z += actor.Velocity.Z*timeStep;
143 actor.IsColliding = false; 145 actor.IsColliding = false;
144 } 146 }
145 } 147 }
146 else 148 else
147 { 149 {
148 actor.Position.Z = height; 150 actorPosition.Z = height;
149 actor.Velocity.Z = 0; 151 actorVelocity.Z = 0;
150 actor.IsColliding = true; 152 actor.IsColliding = true;
151 } 153 }
154
155 actor.Position = actorPosition;
156 actor.Velocity = actorVelocity;
152 } 157 }
158
153 return fps; 159 return fps;
154 } 160 }
155 161