aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-11-29 00:12:11 +0000
committerJustin Clark-Casey (justincc)2014-11-29 00:12:11 +0000
commit265fe349e00b3ece59ec02e56f83bb7623e9d962 (patch)
tree42afe816271f54a017fe5f731d905e923ef5d67b /OpenSim/Region
parentAvoid repeated lag-generating continuous attempts to retrieve HG service Urls... (diff)
downloadopensim-SC_OLD-265fe349e00b3ece59ec02e56f83bb7623e9d962.zip
opensim-SC_OLD-265fe349e00b3ece59ec02e56f83bb7623e9d962.tar.gz
opensim-SC_OLD-265fe349e00b3ece59ec02e56f83bb7623e9d962.tar.bz2
opensim-SC_OLD-265fe349e00b3ece59ec02e56f83bb7623e9d962.tar.xz
Somewhat improve avatar region crossings by properly preserving velocity when avatar enters the new region.
This commit addresses the following issues were causing velocity to be set to 0 on the new region, disrupting flight in particular * Full avatar updates contained no velocity information, which does appear to have some effect in testing. * BulletSim was always setting the velocity to 0 for the new BSCharacter. Now, physics engines take a velocity parameter when setting up characters so we can avoid this. This patch applies to both Bullet and ODE.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs44
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs3
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs5
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs41
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs2
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs6
-rw-r--r--OpenSim/Region/Physics/Manager/NullPhysicsScene.cs3
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsScene.cs15
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs6
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdeScene.cs11
-rw-r--r--OpenSim/Region/Physics/POSPlugin/POSScene.cs3
12 files changed, 94 insertions, 54 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 85f9d68..5da0ca1 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -5195,8 +5195,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5195 { 5195 {
5196 ScenePresence presence = (ScenePresence)entity; 5196 ScenePresence presence = (ScenePresence)entity;
5197 5197
5198// m_log.DebugFormat( 5198// m_log.DebugFormat(
5199// "[LLCLIENTVIEW]: Sending terse update to {0} with position {1} in {2}", Name, presence.OffsetPosition, m_scene.Name); 5199// "[LLCLIENTVIEW]: Sending terse update to {0} with pos {1}, vel {2} in {3}",
5200// Name, presence.OffsetPosition, presence.Velocity, m_scene.Name);
5200 5201
5201 attachPoint = presence.State; 5202 attachPoint = presence.State;
5202 collisionPlane = presence.CollisionPlane; 5203 collisionPlane = presence.CollisionPlane;
@@ -5333,13 +5334,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5333 protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data) 5334 protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data)
5334 { 5335 {
5335// m_log.DebugFormat( 5336// m_log.DebugFormat(
5336// "[LLCLIENTVIEW]: Sending full update to {0} with position {1} in {2}", Name, data.OffsetPosition, m_scene.Name); 5337// "[LLCLIENTVIEW]: Sending full update to {0} with pos {1}, vel {2} in {3}", Name, data.OffsetPosition, data.Velocity, m_scene.Name);
5337 5338
5338 byte[] objectData = new byte[76]; 5339 byte[] objectData = new byte[76];
5339 5340
5340 data.CollisionPlane.ToBytes(objectData, 0); 5341 data.CollisionPlane.ToBytes(objectData, 0);
5341 data.OffsetPosition.ToBytes(objectData, 16); 5342 data.OffsetPosition.ToBytes(objectData, 16);
5342// data.Velocity.ToBytes(objectData, 28); 5343 data.Velocity.ToBytes(objectData, 28);
5343// data.Acceleration.ToBytes(objectData, 40); 5344// data.Acceleration.ToBytes(objectData, 40);
5344 5345
5345 // Whilst not in mouselook, an avatar will transmit only the Z rotation as this is the only axis 5346 // Whilst not in mouselook, an avatar will transmit only the Z rotation as this is the only axis
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 5a35aff..966152a 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -636,6 +636,11 @@ namespace OpenSim.Region.Framework.Scenes
636 636
637 set 637 set
638 { 638 {
639// Util.PrintCallStack();
640// m_log.DebugFormat(
641// "[SCENE PRESENCE]: In {0} set velocity of {1} to {2}",
642// Scene.RegionInfo.RegionName, Name, value);
643
639 if (PhysicsActor != null) 644 if (PhysicsActor != null)
640 { 645 {
641 try 646 try
@@ -648,11 +653,7 @@ namespace OpenSim.Region.Framework.Scenes
648 } 653 }
649 } 654 }
650 655
651 m_velocity = value; 656 m_velocity = value;
652
653// m_log.DebugFormat(
654// "[SCENE PRESENCE]: In {0} set velocity of {1} to {2}",
655// Scene.RegionInfo.RegionName, Name, m_velocity);
656 } 657 }
657 } 658 }
658/* 659/*
@@ -1185,15 +1186,23 @@ namespace OpenSim.Region.Framework.Scenes
1185 } 1186 }
1186 AbsolutePosition = pos; 1187 AbsolutePosition = pos;
1187 1188
1189// m_log.DebugFormat(
1190// "Set pos {0}, vel {1} in {1} to {2} from input position of {3} on MakeRootAgent",
1191// Name, Scene.Name, AbsolutePosition, pos);
1192//
1188 if (m_teleportFlags == TeleportFlags.Default) 1193 if (m_teleportFlags == TeleportFlags.Default)
1189 { 1194 {
1190 Vector3 vel = Velocity;
1191 AddToPhysicalScene(isFlying); 1195 AddToPhysicalScene(isFlying);
1192 if (PhysicsActor != null) 1196//
1193 PhysicsActor.SetMomentum(vel); 1197// Console.WriteLine(
1198// "Set velocity of {0} in {1} to {2} from input velocity of {3} on MakeRootAgent",
1199// Name, Scene.Name, PhysicsActor.Velocity, vel);
1200// }
1194 } 1201 }
1195 else 1202 else
1203 {
1196 AddToPhysicalScene(isFlying); 1204 AddToPhysicalScene(isFlying);
1205 }
1197 1206
1198 // XXX: This is to trigger any secondary teleport needed for a megaregion when the user has teleported to a 1207 // XXX: This is to trigger any secondary teleport needed for a megaregion when the user has teleported to a
1199 // location outside the 'root region' (the south-west 256x256 corner). This is the earlist we can do it 1208 // location outside the 'root region' (the south-west 256x256 corner). This is the earlist we can do it
@@ -1211,6 +1220,7 @@ namespace OpenSim.Region.Framework.Scenes
1211 Flying = false; 1220 Flying = false;
1212 } 1221 }
1213 } 1222 }
1223
1214 // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying 1224 // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying
1215 // avatar to return to the standing position in mid-air. On login it looks like this is being sent 1225 // avatar to return to the standing position in mid-air. On login it looks like this is being sent
1216 // elsewhere anyway 1226 // elsewhere anyway
@@ -1275,7 +1285,6 @@ namespace OpenSim.Region.Framework.Scenes
1275 // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will 1285 // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will
1276 // stall on the border crossing since the existing child agent will still have the last movement 1286 // stall on the border crossing since the existing child agent will still have the last movement
1277 // recorded, which stops the input from being processed. 1287 // recorded, which stops the input from being processed.
1278
1279 MovementFlag = 0; 1288 MovementFlag = 0;
1280 1289
1281 m_scene.EventManager.TriggerOnMakeRootAgent(this); 1290 m_scene.EventManager.TriggerOnMakeRootAgent(this);
@@ -3668,10 +3677,7 @@ namespace OpenSim.Region.Framework.Scenes
3668 // Compute the avatar position in the next physics tick. 3677 // Compute the avatar position in the next physics tick.
3669 // If the avatar will be crossing, we force the crossing to happen now 3678 // If the avatar will be crossing, we force the crossing to happen now
3670 // in the hope that this will make the avatar movement smoother when crossing. 3679 // in the hope that this will make the avatar movement smoother when crossing.
3671 float timeStep = 0.1f; 3680 pos2 += vel * 0.1f;
3672 pos2.X = pos2.X + (vel.X * timeStep);
3673 pos2.Y = pos2.Y + (vel.Y * timeStep);
3674 pos2.Z = pos2.Z + (vel.Z * timeStep);
3675 3681
3676 if (m_scene.PositionIsInCurrentRegion(pos2)) 3682 if (m_scene.PositionIsInCurrentRegion(pos2))
3677 return; 3683 return;
@@ -3682,9 +3688,11 @@ namespace OpenSim.Region.Framework.Scenes
3682 // Disconnect from the current region 3688 // Disconnect from the current region
3683 bool isFlying = Flying; 3689 bool isFlying = Flying;
3684 RemoveFromPhysicalScene(); 3690 RemoveFromPhysicalScene();
3691
3685 // pos2 is the forcasted position so make that the 'current' position so the crossing 3692 // pos2 is the forcasted position so make that the 'current' position so the crossing
3686 // code will move us into the newly addressed region. 3693 // code will move us into the newly addressed region.
3687 m_pos = pos2; 3694 m_pos = pos2;
3695
3688 if (CrossToNewRegion()) 3696 if (CrossToNewRegion())
3689 { 3697 {
3690 AddToPhysicalScene(isFlying); 3698 AddToPhysicalScene(isFlying);
@@ -4116,19 +4124,15 @@ namespace OpenSim.Region.Framework.Scenes
4116 if (Appearance.AvatarHeight == 0) 4124 if (Appearance.AvatarHeight == 0)
4117// Appearance.SetHeight(); 4125// Appearance.SetHeight();
4118 Appearance.SetSize(new Vector3(0.45f,0.6f,1.9f)); 4126 Appearance.SetSize(new Vector3(0.45f,0.6f,1.9f));
4119 4127
4120 PhysicsScene scene = m_scene.PhysicsScene;
4121
4122 Vector3 pVec = AbsolutePosition;
4123
4124/* 4128/*
4125 PhysicsActor = scene.AddAvatar( 4129 PhysicsActor = scene.AddAvatar(
4126 LocalId, Firstname + "." + Lastname, pVec, 4130 LocalId, Firstname + "." + Lastname, pVec,
4127 new Vector3(0.45f, 0.6f, Appearance.AvatarHeight), isFlying); 4131 new Vector3(0.45f, 0.6f, Appearance.AvatarHeight), isFlying);
4128*/ 4132*/
4129 4133
4130 PhysicsActor = scene.AddAvatar( 4134 PhysicsActor = m_scene.PhysicsScene.AddAvatar(
4131 LocalId, Firstname + "." + Lastname, pVec, 4135 LocalId, Firstname + "." + Lastname, AbsolutePosition, Velocity,
4132 Appearance.AvatarBoxSize, isFlying); 4136 Appearance.AvatarBoxSize, isFlying);
4133 4137
4134 //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; 4138 //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
index f53adcb..06a205e 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
@@ -80,10 +80,11 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
80 return prim; 80 return prim;
81 } 81 }
82 82
83 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) 83 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying)
84 { 84 {
85 BasicActor act = new BasicActor(size); 85 BasicActor act = new BasicActor(size);
86 act.Position = position; 86 act.Position = position;
87 act.Velocity = velocity;
87 act.Flying = isFlying; 88 act.Flying = isFlying;
88 _actors.Add(act); 89 _actors.Add(act);
89 return act; 90 return act;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs
index 14518e9..8e998ba 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using System.Linq; 30using System.Linq;
31using System.Text; 31using System.Text;
32 32
33using OpenSim.Framework;
33using OpenSim.Region.Physics.Manager; 34using OpenSim.Region.Physics.Manager;
34 35
35using OMV = OpenMetaverse; 36using OMV = OpenMetaverse;
@@ -109,6 +110,10 @@ public class BSActorAvatarMove : BSActor
109 { 110 {
110 if (m_velocityMotor != null) 111 if (m_velocityMotor != null)
111 { 112 {
113// if (targ == OMV.Vector3.Zero)
114// Util.PrintCallStack();
115//
116// Console.WriteLine("SetVelocityAndTarget, {0} {1}", vel, targ);
112 m_velocityMotor.Reset(); 117 m_velocityMotor.Reset();
113 m_velocityMotor.SetTarget(targ); 118 m_velocityMotor.SetTarget(targ);
114 m_velocityMotor.SetCurrent(vel); 119 m_velocityMotor.SetCurrent(vel);
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index 4c54f9f..f29784a 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -64,15 +64,25 @@ public sealed class BSCharacter : BSPhysObject
64 private bool _usePID; 64 private bool _usePID;
65 private float _PIDTau; 65 private float _PIDTau;
66 66
67 public BSCharacter(uint localID, String avName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size, bool isFlying) 67// public override OMV.Vector3 RawVelocity
68// { get { return base.RawVelocity; }
69// set {
70// if (value != base.RawVelocity)
71// Util.PrintCallStack();
72// Console.WriteLine("Set rawvel to {0}", value);
73// base.RawVelocity = value; }
74// }
75
76 public BSCharacter(
77 uint localID, String avName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 vel, OMV.Vector3 size, bool isFlying)
68 : base(parent_scene, localID, avName, "BSCharacter") 78 : base(parent_scene, localID, avName, "BSCharacter")
69 { 79 {
70 _physicsActorType = (int)ActorTypes.Agent; 80 _physicsActorType = (int)ActorTypes.Agent;
71 RawPosition = pos; 81 RawPosition = pos;
72 82
73 _flying = isFlying; 83 _flying = isFlying;
74 RawOrientation = OMV.Quaternion.Identity; 84 RawOrientation = OMV.Quaternion.Identity;
75 RawVelocity = OMV.Vector3.Zero; 85 RawVelocity = vel;
76 _buoyancy = ComputeBuoyancyFromFlying(isFlying); 86 _buoyancy = ComputeBuoyancyFromFlying(isFlying);
77 Friction = BSParam.AvatarStandingFriction; 87 Friction = BSParam.AvatarStandingFriction;
78 Density = BSParam.AvatarDensity; 88 Density = BSParam.AvatarDensity;
@@ -89,13 +99,15 @@ public sealed class BSCharacter : BSPhysObject
89 // set _avatarVolume and _mass based on capsule size, _density and Scale 99 // set _avatarVolume and _mass based on capsule size, _density and Scale
90 ComputeAvatarVolumeAndMass(); 100 ComputeAvatarVolumeAndMass();
91 101
92 DetailLog("{0},BSCharacter.create,call,size={1},scale={2},density={3},volume={4},mass={5},pos={6}", 102 DetailLog(
93 LocalID, _size, Scale, Density, _avatarVolume, RawMass, pos); 103 "{0},BSCharacter.create,call,size={1},scale={2},density={3},volume={4},mass={5},pos={6},vel={7}",
104 LocalID, _size, Scale, Density, _avatarVolume, RawMass, pos, vel);
94 105
95 // do actual creation in taint time 106 // do actual creation in taint time
96 PhysScene.TaintedObject(LocalID, "BSCharacter.create", delegate() 107 PhysScene.TaintedObject(LocalID, "BSCharacter.create", delegate()
97 { 108 {
98 DetailLog("{0},BSCharacter.create,taint", LocalID); 109 DetailLog("{0},BSCharacter.create,taint", LocalID);
110
99 // New body and shape into PhysBody and PhysShape 111 // New body and shape into PhysBody and PhysShape
100 PhysScene.Shapes.GetBodyAndShape(true, PhysScene.World, this); 112 PhysScene.Shapes.GetBodyAndShape(true, PhysScene.World, this);
101 113
@@ -142,6 +154,7 @@ public sealed class BSCharacter : BSPhysObject
142 m_moveActor.SetVelocityAndTarget(RawVelocity, RawVelocity, false); 154 m_moveActor.SetVelocityAndTarget(RawVelocity, RawVelocity, false);
143 155
144 ForceVelocity = RawVelocity; 156 ForceVelocity = RawVelocity;
157 TargetVelocity = RawVelocity;
145 158
146 // This will enable or disable the flying buoyancy of the avatar. 159 // This will enable or disable the flying buoyancy of the avatar.
147 // Needs to be reset especially when an avatar is recreated after crossing a region boundry. 160 // Needs to be reset especially when an avatar is recreated after crossing a region boundry.
@@ -256,7 +269,6 @@ public sealed class BSCharacter : BSPhysObject
256 // Called at taint time! 269 // Called at taint time!
257 public override void ZeroMotion(bool inTaintTime) 270 public override void ZeroMotion(bool inTaintTime)
258 { 271 {
259 RawVelocity = OMV.Vector3.Zero;
260 _acceleration = OMV.Vector3.Zero; 272 _acceleration = OMV.Vector3.Zero;
261 _rotationalVelocity = OMV.Vector3.Zero; 273 _rotationalVelocity = OMV.Vector3.Zero;
262 274
@@ -267,6 +279,7 @@ public sealed class BSCharacter : BSPhysObject
267 PhysScene.PE.ClearAllForces(PhysBody); 279 PhysScene.PE.ClearAllForces(PhysBody);
268 }); 280 });
269 } 281 }
282
270 public override void ZeroAngularMotion(bool inTaintTime) 283 public override void ZeroAngularMotion(bool inTaintTime)
271 { 284 {
272 _rotationalVelocity = OMV.Vector3.Zero; 285 _rotationalVelocity = OMV.Vector3.Zero;
@@ -441,32 +454,40 @@ public sealed class BSCharacter : BSPhysObject
441 get { return RawVelocity; } 454 get { return RawVelocity; }
442 set { 455 set {
443 RawVelocity = value; 456 RawVelocity = value;
444 // m_log.DebugFormat("{0}: set velocity = {1}", LogHeader, RawVelocity); 457 OMV.Vector3 vel = RawVelocity;
458
459 DetailLog("{0}: set Velocity = {1}", LogHeader, value);
460
445 PhysScene.TaintedObject(LocalID, "BSCharacter.setVelocity", delegate() 461 PhysScene.TaintedObject(LocalID, "BSCharacter.setVelocity", delegate()
446 { 462 {
447 if (m_moveActor != null) 463 if (m_moveActor != null)
448 m_moveActor.SetVelocityAndTarget(RawVelocity, RawVelocity, true /* inTaintTime */); 464 m_moveActor.SetVelocityAndTarget(vel, vel, true /* inTaintTime */);
449 465
450 DetailLog("{0},BSCharacter.setVelocity,taint,vel={1}", LocalID, RawVelocity); 466 m_log.DebugFormat("{0},BSCharacter.setVelocity,taint,vel={1}", LocalID, vel);
451 ForceVelocity = RawVelocity; 467 ForceVelocity = vel;
452 }); 468 });
453 } 469 }
454 } 470 }
471
455 public override OMV.Vector3 ForceVelocity { 472 public override OMV.Vector3 ForceVelocity {
456 get { return RawVelocity; } 473 get { return RawVelocity; }
457 set { 474 set {
458 PhysScene.AssertInTaintTime("BSCharacter.ForceVelocity"); 475 PhysScene.AssertInTaintTime("BSCharacter.ForceVelocity");
476// Util.PrintCallStack();
477 DetailLog("{0}: set ForceVelocity = {1}", LogHeader, value);
459 478
460 RawVelocity = value; 479 RawVelocity = value;
461 PhysScene.PE.SetLinearVelocity(PhysBody, RawVelocity); 480 PhysScene.PE.SetLinearVelocity(PhysBody, RawVelocity);
462 PhysScene.PE.Activate(PhysBody, true); 481 PhysScene.PE.Activate(PhysBody, true);
463 } 482 }
464 } 483 }
484
465 public override OMV.Vector3 Torque { 485 public override OMV.Vector3 Torque {
466 get { return RawTorque; } 486 get { return RawTorque; }
467 set { RawTorque = value; 487 set { RawTorque = value;
468 } 488 }
469 } 489 }
490
470 public override float CollisionScore { 491 public override float CollisionScore {
471 get { return _collisionScore; } 492 get { return _collisionScore; }
472 set { _collisionScore = value; 493 set { _collisionScore = value;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
index f059322..e4d8df8 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
@@ -228,7 +228,7 @@ public abstract class BSPhysObject : PhysicsActor
228 public virtual OMV.Quaternion RawOrientation { get; set; } 228 public virtual OMV.Quaternion RawOrientation { get; set; }
229 public abstract OMV.Quaternion ForceOrientation { get; set; } 229 public abstract OMV.Quaternion ForceOrientation { get; set; }
230 230
231 public OMV.Vector3 RawVelocity { get; set; } 231 public virtual OMV.Vector3 RawVelocity { get; set; }
232 public abstract OMV.Vector3 ForceVelocity { get; set; } 232 public abstract OMV.Vector3 ForceVelocity { get; set; }
233 233
234 public OMV.Vector3 RawForce { get; set; } 234 public OMV.Vector3 RawForce { get; set; }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index 0f79a10..414bc92 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -461,19 +461,19 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
461 461
462 #region Prim and Avatar addition and removal 462 #region Prim and Avatar addition and removal
463 463
464 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) 464 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying)
465 { 465 {
466 m_log.ErrorFormat("{0}: CALL TO AddAvatar in BSScene. NOT IMPLEMENTED", LogHeader); 466 m_log.ErrorFormat("{0}: CALL TO AddAvatar in BSScene. NOT IMPLEMENTED", LogHeader);
467 return null; 467 return null;
468 } 468 }
469 469
470 public override PhysicsActor AddAvatar(uint localID, string avName, Vector3 position, Vector3 size, bool isFlying) 470 public override PhysicsActor AddAvatar(uint localID, string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying)
471 { 471 {
472 // m_log.DebugFormat("{0}: AddAvatar: {1}", LogHeader, avName); 472 // m_log.DebugFormat("{0}: AddAvatar: {1}", LogHeader, avName);
473 473
474 if (!m_initialized) return null; 474 if (!m_initialized) return null;
475 475
476 BSCharacter actor = new BSCharacter(localID, avName, this, position, size, isFlying); 476 BSCharacter actor = new BSCharacter(localID, avName, this, position, velocity, size, isFlying);
477 lock (PhysObjects) 477 lock (PhysObjects)
478 PhysObjects.Add(localID, actor); 478 PhysObjects.Add(localID, actor);
479 479
diff --git a/OpenSim/Region/Physics/Manager/NullPhysicsScene.cs b/OpenSim/Region/Physics/Manager/NullPhysicsScene.cs
index 1ccf46d..b52f1f6 100644
--- a/OpenSim/Region/Physics/Manager/NullPhysicsScene.cs
+++ b/OpenSim/Region/Physics/Manager/NullPhysicsScene.cs
@@ -45,7 +45,8 @@ namespace OpenSim.Region.Physics.Manager
45 // Does nothing right now 45 // Does nothing right now
46 } 46 }
47 47
48 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) 48 public override PhysicsActor AddAvatar(
49 string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying)
49 { 50 {
50 m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddAvatar({0})", position); 51 m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddAvatar({0})", position);
51 return PhysicsActor.Null; 52 return PhysicsActor.Null;
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
index 71ad795..9cdedbf 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
@@ -142,10 +142,12 @@ namespace OpenSim.Region.Physics.Manager
142 /// </summary> 142 /// </summary>
143 /// <param name="avName"></param> 143 /// <param name="avName"></param>
144 /// <param name="position"></param> 144 /// <param name="position"></param>
145 /// <param name="velocity"></param>
145 /// <param name="size"></param> 146 /// <param name="size"></param>
146 /// <param name="isFlying"></param> 147 /// <param name="isFlying"></param>
147 /// <returns></returns> 148 /// <returns></returns>
148 public abstract PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying); 149 public abstract PhysicsActor AddAvatar(
150 string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying);
149 151
150 /// <summary> 152 /// <summary>
151 /// Add an avatar 153 /// Add an avatar
@@ -153,13 +155,18 @@ namespace OpenSim.Region.Physics.Manager
153 /// <param name="localID"></param> 155 /// <param name="localID"></param>
154 /// <param name="avName"></param> 156 /// <param name="avName"></param>
155 /// <param name="position"></param> 157 /// <param name="position"></param>
158 /// <param name="velocity"></param>
156 /// <param name="size"></param> 159 /// <param name="size"></param>
157 /// <param name="isFlying"></param> 160 /// <param name="isFlying"></param>
158 /// <returns></returns> 161 /// <returns></returns>
159 public virtual PhysicsActor AddAvatar(uint localID, string avName, Vector3 position, Vector3 size, bool isFlying) 162 public virtual PhysicsActor AddAvatar(
163 uint localID, string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying)
160 { 164 {
161 PhysicsActor ret = AddAvatar(avName, position, size, isFlying); 165 PhysicsActor ret = AddAvatar(avName, position, velocity, size, isFlying);
162 if (ret != null) ret.LocalID = localID; 166
167 if (ret != null)
168 ret.LocalID = localID;
169
163 return ret; 170 return ret;
164 } 171 }
165 172
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 67503df..05eaf2a 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -167,6 +167,7 @@ namespace OpenSim.Region.Physics.OdePlugin
167 /// <param name="avName"></param> 167 /// <param name="avName"></param>
168 /// <param name="parent_scene"></param> 168 /// <param name="parent_scene"></param>
169 /// <param name="pos"></param> 169 /// <param name="pos"></param>
170 /// <param name="vel"></param>
170 /// <param name="size"></param> 171 /// <param name="size"></param>
171 /// <param name="pid_d"></param> 172 /// <param name="pid_d"></param>
172 /// <param name="pid_p"></param> 173 /// <param name="pid_p"></param>
@@ -178,7 +179,7 @@ namespace OpenSim.Region.Physics.OdePlugin
178 /// <param name="walk_divisor"></param> 179 /// <param name="walk_divisor"></param>
179 /// <param name="rundivisor"></param> 180 /// <param name="rundivisor"></param>
180 public OdeCharacter( 181 public OdeCharacter(
181 String avName, OdeScene parent_scene, Vector3 pos, Vector3 size, float pid_d, float pid_p, 182 String avName, OdeScene parent_scene, Vector3 pos, Vector3 vel, Vector3 size, float pid_d, float pid_p,
182 float capsule_radius, float tensor, float density, 183 float capsule_radius, float tensor, float density,
183 float walk_divisor, float rundivisor) 184 float walk_divisor, float rundivisor)
184 { 185 {
@@ -210,6 +211,9 @@ namespace OpenSim.Region.Physics.OdePlugin
210 m_log.WarnFormat("[ODE CHARACTER]: Got NaN Position on Character Create for {0}", avName); 211 m_log.WarnFormat("[ODE CHARACTER]: Got NaN Position on Character Create for {0}", avName);
211 } 212 }
212 213
214 _velocity = vel;
215 m_taintTargetVelocity = vel;
216
213 _parent_scene = parent_scene; 217 _parent_scene = parent_scene;
214 218
215 PID_D = pid_d; 219 PID_D = pid_d;
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
index 6d7f079..5953557 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
@@ -1969,16 +1969,11 @@ namespace OpenSim.Region.Physics.OdePlugin
1969 1969
1970 #region Add/Remove Entities 1970 #region Add/Remove Entities
1971 1971
1972 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) 1972 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying)
1973 { 1973 {
1974 Vector3 pos;
1975 pos.X = position.X;
1976 pos.Y = position.Y;
1977 pos.Z = position.Z;
1978
1979 OdeCharacter newAv 1974 OdeCharacter newAv
1980 = new OdeCharacter( 1975 = new OdeCharacter(
1981 avName, this, pos, size, avPIDD, avPIDP, 1976 avName, this, position, velocity, size, avPIDD, avPIDP,
1982 avCapRadius, avStandupTensor, avDensity, 1977 avCapRadius, avStandupTensor, avDensity,
1983 avMovementDivisorWalk, avMovementDivisorRun); 1978 avMovementDivisorWalk, avMovementDivisorRun);
1984 1979
diff --git a/OpenSim/Region/Physics/POSPlugin/POSScene.cs b/OpenSim/Region/Physics/POSPlugin/POSScene.cs
index d30d482..080c6ab 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSScene.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSScene.cs
@@ -58,7 +58,8 @@ namespace OpenSim.Region.Physics.POSPlugin
58 { 58 {
59 } 59 }
60 60
61 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) 61 public override PhysicsActor AddAvatar(
62 string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying)
62 { 63 {
63 POSCharacter act = new POSCharacter(); 64 POSCharacter act = new POSCharacter();
64 act.Position = position; 65 act.Position = position;