diff options
Diffstat (limited to 'OpenSim/Region/Physics/POSPlugin')
-rw-r--r-- | OpenSim/Region/Physics/POSPlugin/POSCharacter.cs | 9 | ||||
-rw-r--r-- | OpenSim/Region/Physics/POSPlugin/POSScene.cs | 30 |
2 files changed, 26 insertions, 13 deletions
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 |