diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs | 12 | ||||
-rw-r--r-- | OpenSim/Region/Physics/POSPlugin/POSCharacter.cs | 9 | ||||
-rw-r--r-- | OpenSim/Region/Physics/POSPlugin/POSScene.cs | 30 |
3 files changed, 34 insertions, 17 deletions
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs index cacb9eb..6a27f46 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs | |||
@@ -152,7 +152,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
152 | actor.Position.X = 255.9F; | 152 | actor.Position.X = 255.9F; |
153 | } | 153 | } |
154 | 154 | ||
155 | float height = _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + 1.0f; | 155 | float height = _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + actor.Size.Z; |
156 | if (actor.Flying) | 156 | if (actor.Flying) |
157 | { | 157 | { |
158 | if (actor.Position.Z + (actor.Velocity.Z*timeStep) < | 158 | if (actor.Position.Z + (actor.Velocity.Z*timeStep) < |
@@ -210,15 +210,16 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
210 | private PhysicsVector _position; | 210 | private PhysicsVector _position; |
211 | private PhysicsVector _velocity; | 211 | private PhysicsVector _velocity; |
212 | private PhysicsVector _acceleration; | 212 | private PhysicsVector _acceleration; |
213 | private PhysicsVector _size; | ||
213 | private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero; | 214 | private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero; |
214 | private bool flying; | 215 | private bool flying; |
215 | private bool iscolliding; | 216 | private bool iscolliding; |
216 | |||
217 | public BasicActor() | 217 | public BasicActor() |
218 | { | 218 | { |
219 | _velocity = new PhysicsVector(); | 219 | _velocity = new PhysicsVector(); |
220 | _position = new PhysicsVector(); | 220 | _position = new PhysicsVector(); |
221 | _acceleration = new PhysicsVector(); | 221 | _acceleration = new PhysicsVector(); |
222 | _size = new PhysicsVector(); | ||
222 | } | 223 | } |
223 | 224 | ||
224 | public override int PhysicsActorType | 225 | public override int PhysicsActorType |
@@ -315,8 +316,11 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
315 | 316 | ||
316 | public override PhysicsVector Size | 317 | public override PhysicsVector Size |
317 | { | 318 | { |
318 | get { return PhysicsVector.Zero; } | 319 | get { return _size; } |
319 | set { } | 320 | set { |
321 | _size = value; | ||
322 | _size.Z = _size.Z / 2.0f; | ||
323 | } | ||
320 | } | 324 | } |
321 | 325 | ||
322 | public override PrimitiveBaseShape Shape | 326 | public override PrimitiveBaseShape Shape |
diff --git a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs index a9ddf27..8c185fc 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs | |||
@@ -39,6 +39,7 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
39 | private PhysicsVector _position; | 39 | private PhysicsVector _position; |
40 | public PhysicsVector _velocity; | 40 | public PhysicsVector _velocity; |
41 | public PhysicsVector _target_velocity = PhysicsVector.Zero; | 41 | public PhysicsVector _target_velocity = PhysicsVector.Zero; |
42 | public PhysicsVector _size = PhysicsVector.Zero; | ||
42 | private PhysicsVector _acceleration; | 43 | private PhysicsVector _acceleration; |
43 | private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero; | 44 | private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero; |
44 | private bool flying; | 45 | private bool flying; |
@@ -144,8 +145,12 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
144 | 145 | ||
145 | public override PhysicsVector Size | 146 | public override PhysicsVector Size |
146 | { | 147 | { |
147 | get { return new PhysicsVector(0.5f, 0.5f, 1.0f); } | 148 | get { return _size; } |
148 | set { } | 149 | set |
150 | { | ||
151 | _size = value; | ||
152 | _size.Z = _size.Z / 2.0f; | ||
153 | } | ||
149 | } | 154 | } |
150 | 155 | ||
151 | public override float Mass | 156 | public override float Mass |
diff --git a/OpenSim/Region/Physics/POSPlugin/POSScene.cs b/OpenSim/Region/Physics/POSPlugin/POSScene.cs index 9771a62..9a4e92f 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSScene.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSScene.cs | |||
@@ -167,7 +167,7 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
167 | float terrainheight = _heightMap[(int)character.Position.Y * Constants.RegionSize + (int)character.Position.X]; | 167 | float terrainheight = _heightMap[(int)character.Position.Y * Constants.RegionSize + (int)character.Position.X]; |
168 | if (character.Position.Z + (character._target_velocity.Z * timeStep) < terrainheight + 2) | 168 | if (character.Position.Z + (character._target_velocity.Z * timeStep) < terrainheight + 2) |
169 | { | 169 | { |
170 | character.Position.Z = terrainheight + 1.0f; | 170 | character.Position.Z = terrainheight + character.Size.Z; |
171 | forcedZ = true; | 171 | forcedZ = true; |
172 | } | 172 | } |
173 | else | 173 | else |
@@ -184,23 +184,31 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
184 | character.Position.Z = oldposZ; // first try Z axis | 184 | character.Position.Z = oldposZ; // first try Z axis |
185 | if (isCollidingWithPrim(character)) | 185 | if (isCollidingWithPrim(character)) |
186 | { | 186 | { |
187 | character.Position.Z = oldposZ + 0.4f; // try harder | 187 | character.Position.Z = oldposZ + character.Size.Z / 4.4f; // try harder |
188 | if (isCollidingWithPrim(character)) | 188 | if (isCollidingWithPrim(character)) |
189 | { | 189 | { |
190 | character.Position.X = oldposX; | 190 | character.Position.Z = oldposZ + character.Size.Z / 2.2f; // try very hard |
191 | character.Position.Y = oldposY; | ||
192 | character.Position.Z = oldposZ; | ||
193 | |||
194 | character.Position.X += character._target_velocity.X * timeStep; | ||
195 | if (isCollidingWithPrim(character)) | 191 | if (isCollidingWithPrim(character)) |
196 | { | 192 | { |
197 | character.Position.X = oldposX; | 193 | character.Position.X = oldposX; |
194 | character.Position.Y = oldposY; | ||
195 | character.Position.Z = oldposZ; | ||
196 | |||
197 | character.Position.X += character._target_velocity.X * timeStep; | ||
198 | if (isCollidingWithPrim(character)) | ||
199 | { | ||
200 | character.Position.X = oldposX; | ||
201 | } | ||
202 | |||
203 | character.Position.Y += character._target_velocity.Y * timeStep; | ||
204 | if (isCollidingWithPrim(character)) | ||
205 | { | ||
206 | character.Position.Y = oldposY; | ||
207 | } | ||
198 | } | 208 | } |
199 | 209 | else | |
200 | character.Position.Y += character._target_velocity.Y * timeStep; | ||
201 | if (isCollidingWithPrim(character)) | ||
202 | { | 210 | { |
203 | character.Position.Y = oldposY; | 211 | forcedZ = true; |
204 | } | 212 | } |
205 | } | 213 | } |
206 | else | 214 | else |