* Added Rotational Velocity reporting for Client Interpolation to Terse Updates
* Added Angular Velocity reporting for smooth-ish rotations on object collisionsafrisby
parent
08701ee7fc
commit
9e9dad1cde
|
@ -409,7 +409,7 @@ namespace OpenSim.Framework
|
|||
void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
|
||||
LLQuaternion rotation);
|
||||
void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
|
||||
LLQuaternion rotation,LLVector3 velocity);
|
||||
LLQuaternion rotation,LLVector3 velocity, LLVector3 rotationalvelocity);
|
||||
|
||||
void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items);
|
||||
void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item);
|
||||
|
|
|
@ -1062,23 +1062,24 @@ namespace OpenSim.Region.ClientStack
|
|||
LLQuaternion rotation)
|
||||
{
|
||||
LLVector3 velocity = new LLVector3(0f,0f,0f);
|
||||
LLVector3 rotationalvelocity = new LLVector3(0f,0f,0f);
|
||||
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
|
||||
terse.RegionData.RegionHandle = regionHandle;
|
||||
terse.RegionData.TimeDilation = timeDilation;
|
||||
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
||||
terse.ObjectData[0] = CreatePrimImprovedBlock(localID, position, rotation, velocity);
|
||||
terse.ObjectData[0] = CreatePrimImprovedBlock(localID, position, rotation, velocity, rotationalvelocity);
|
||||
|
||||
OutPacket(terse);
|
||||
}
|
||||
public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
|
||||
LLQuaternion rotation, LLVector3 velocity)
|
||||
LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity)
|
||||
{
|
||||
|
||||
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
|
||||
terse.RegionData.RegionHandle = regionHandle;
|
||||
terse.RegionData.TimeDilation = timeDilation;
|
||||
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
||||
terse.ObjectData[0] = CreatePrimImprovedBlock(localID, position, rotation, velocity);
|
||||
terse.ObjectData[0] = CreatePrimImprovedBlock(localID, position, rotation, velocity, rotationalvelocity);
|
||||
|
||||
OutPacket(terse);
|
||||
}
|
||||
|
@ -1184,7 +1185,7 @@ namespace OpenSim.Region.ClientStack
|
|||
/// <returns></returns>
|
||||
protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreatePrimImprovedBlock(uint localID,
|
||||
LLVector3 position,
|
||||
LLQuaternion rotation, LLVector3 velocity)
|
||||
LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity)
|
||||
{
|
||||
uint ID = localID;
|
||||
byte[] bytes = new byte[60];
|
||||
|
@ -1248,12 +1249,24 @@ namespace OpenSim.Region.ClientStack
|
|||
bytes[i++] = (byte) ((rw >> 8)%256);
|
||||
|
||||
//rotation vel
|
||||
bytes[i++] = (byte) (ac%256);
|
||||
bytes[i++] = (byte) ((ac >> 8)%256);
|
||||
bytes[i++] = (byte) (ac%256);
|
||||
bytes[i++] = (byte) ((ac >> 8)%256);
|
||||
bytes[i++] = (byte) (ac%256);
|
||||
bytes[i++] = (byte) ((ac >> 8)%256);
|
||||
ushort rvelx, rvely, rvelz;
|
||||
Vector3 rvel = new Vector3(rotationalvelocity.X, rotationalvelocity.Y, rotationalvelocity.Z);
|
||||
|
||||
rvel = rvel / 128.0f;
|
||||
rvel.x += 1;
|
||||
rvel.y += 1;
|
||||
rvel.z += 1;
|
||||
//vel
|
||||
rvelx = (ushort)(32768 * (rvel.x));
|
||||
rvely = (ushort)(32768 * (rvel.y));
|
||||
rvelz = (ushort)(32768 * (rvel.z));
|
||||
|
||||
bytes[i++] = (byte)(rvelx % 256);
|
||||
bytes[i++] = (byte)((rvelx >> 8) % 256);
|
||||
bytes[i++] = (byte)(rvely % 256);
|
||||
bytes[i++] = (byte)((rvely >> 8) % 256);
|
||||
bytes[i++] = (byte)(rvelz % 256);
|
||||
bytes[i++] = (byte)((rvelz >> 8) % 256);
|
||||
|
||||
dat.Data = bytes;
|
||||
return dat;
|
||||
|
|
|
@ -69,6 +69,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
|
||||
protected LLVector3 m_velocity;
|
||||
protected LLVector3 m_rotationalvelocity;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
|
@ -106,7 +107,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
m_velocity = new LLVector3();
|
||||
Rotation = new Quaternion();
|
||||
m_name = "(basic entity)";
|
||||
|
||||
m_rotationalvelocity = new LLVector3(0, 0, 0);
|
||||
m_children = new List<EntityBase>();
|
||||
}
|
||||
|
||||
|
|
|
@ -231,6 +231,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
|
||||
protected LLVector3 m_velocity;
|
||||
protected LLVector3 m_rotationalvelocity;
|
||||
|
||||
/// <summary></summary>
|
||||
public LLVector3 Velocity
|
||||
|
@ -253,6 +254,28 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
set { m_velocity = value; }
|
||||
}
|
||||
public LLVector3 RotationalVelocity
|
||||
{
|
||||
get
|
||||
{
|
||||
//if (PhysActor.Velocity.x != 0 || PhysActor.Velocity.y != 0
|
||||
//|| PhysActor.Velocity.z != 0)
|
||||
//{
|
||||
if (PhysActor != null)
|
||||
{
|
||||
if (PhysActor.IsPhysical)
|
||||
{
|
||||
m_rotationalvelocity.X = PhysActor.RotationalVelocity.X;
|
||||
m_rotationalvelocity.Y = PhysActor.RotationalVelocity.Y;
|
||||
m_rotationalvelocity.Z = PhysActor.RotationalVelocity.Z;
|
||||
}
|
||||
}
|
||||
|
||||
return m_rotationalvelocity;
|
||||
}
|
||||
set { m_rotationalvelocity = value; }
|
||||
}
|
||||
|
||||
|
||||
protected LLVector3 m_angularVelocity;
|
||||
|
||||
|
@ -384,6 +407,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
OffsetPosition = offsetPosition;
|
||||
RotationOffset = rotationOffset;
|
||||
Velocity = new LLVector3(0, 0, 0);
|
||||
m_rotationalvelocity = new LLVector3(0, 0, 0);
|
||||
AngularVelocity = new LLVector3(0, 0, 0);
|
||||
Acceleration = new LLVector3(0, 0, 0);
|
||||
|
||||
|
@ -1020,7 +1044,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
else
|
||||
{
|
||||
remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot, Velocity);
|
||||
remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot, Velocity, RotationalVelocity);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1033,8 +1057,8 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
else
|
||||
{
|
||||
remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot, Velocity);
|
||||
//System.Console.WriteLine("Vel:" + Velocity);
|
||||
remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot, Velocity, RotationalVelocity);
|
||||
//System.Console.WriteLine("RVel:" + RotationalVelocity);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -282,7 +282,7 @@ namespace SimpleApp
|
|||
{
|
||||
}
|
||||
public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID,
|
||||
LLVector3 position, LLQuaternion rotation,LLVector3 velocity)
|
||||
LLVector3 position, LLQuaternion rotation,LLVector3 velocity, LLVector3 rotationalvelocity)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -181,6 +181,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
|||
private PhysicsVector _position;
|
||||
private PhysicsVector _velocity;
|
||||
private PhysicsVector _acceleration;
|
||||
private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero;
|
||||
private bool flying;
|
||||
private bool iscolliding;
|
||||
|
||||
|
@ -190,7 +191,11 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
|||
_position = new PhysicsVector();
|
||||
_acceleration = new PhysicsVector();
|
||||
}
|
||||
|
||||
public override PhysicsVector RotationalVelocity
|
||||
{
|
||||
get { return m_rotationalVelocity; }
|
||||
set { m_rotationalVelocity = value; }
|
||||
}
|
||||
public override bool IsPhysical
|
||||
{
|
||||
get { return false; }
|
||||
|
|
|
@ -643,6 +643,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
protected PhysicsVector _size;
|
||||
protected PhysicsVector _acceleration;
|
||||
protected AxiomQuaternion _orientation;
|
||||
protected PhysicsVector m_rotationalVelocity = PhysicsVector.Zero;
|
||||
protected RigidBody rigidBody;
|
||||
private Boolean iscolliding = false;
|
||||
|
||||
|
@ -662,6 +663,11 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
}
|
||||
}
|
||||
}
|
||||
public override PhysicsVector RotationalVelocity
|
||||
{
|
||||
get { return m_rotationalVelocity; }
|
||||
set { m_rotationalVelocity = value; }
|
||||
}
|
||||
public override PhysicsVector Velocity
|
||||
{
|
||||
get { return _velocity; }
|
||||
|
|
|
@ -36,6 +36,8 @@ namespace OpenSim.Region.Physics.Manager
|
|||
|
||||
public delegate void OrientationUpdate(Quaternion orientation);
|
||||
|
||||
|
||||
|
||||
public abstract class PhysicsActor
|
||||
{
|
||||
#pragma warning disable 67
|
||||
|
@ -69,6 +71,7 @@ namespace OpenSim.Region.Physics.Manager
|
|||
public abstract bool Flying { get; set; }
|
||||
|
||||
public abstract bool IsColliding { get; set; }
|
||||
public abstract PhysicsVector RotationalVelocity { get; set; }
|
||||
|
||||
public abstract bool Kinematic { get; set; }
|
||||
|
||||
|
@ -144,7 +147,11 @@ namespace OpenSim.Region.Physics.Manager
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public override PhysicsVector RotationalVelocity
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
public override void SetMomentum(PhysicsVector momentum)
|
||||
{
|
||||
return;
|
||||
|
|
|
@ -617,6 +617,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
private PhysicsVector _velocity;
|
||||
private PhysicsVector _target_velocity;
|
||||
private PhysicsVector _acceleration;
|
||||
private PhysicsVector m_rotationalVelocity;
|
||||
private static float PID_D = 4000.0f;
|
||||
private static float PID_P = 7000.0f;
|
||||
private static float POSTURE_SERVO = 10000.0f;
|
||||
|
@ -682,7 +683,11 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override PhysicsVector RotationalVelocity
|
||||
{
|
||||
get { return m_rotationalVelocity; }
|
||||
set { m_rotationalVelocity = value; }
|
||||
}
|
||||
public override PhysicsVector Size
|
||||
{
|
||||
get { return new PhysicsVector(CAPSULE_RADIUS*2, CAPSULE_RADIUS*2, CAPSULE_LENGTH); }
|
||||
|
@ -858,6 +863,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
private PhysicsVector _velocity;
|
||||
private PhysicsVector m_lastVelocity = new PhysicsVector(0.0f,0.0f,0.0f);
|
||||
private PhysicsVector m_lastposition = new PhysicsVector(0.0f, 0.0f, 0.0f);
|
||||
private PhysicsVector m_rotationalVelocity;
|
||||
private PhysicsVector _size;
|
||||
private PhysicsVector _acceleration;
|
||||
public Quaternion _orientation;
|
||||
|
@ -887,6 +893,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
_position = pos;
|
||||
_size = size;
|
||||
_acceleration = new PhysicsVector();
|
||||
m_rotationalVelocity = PhysicsVector.Zero;
|
||||
_orientation = rotation;
|
||||
_mesh = mesh;
|
||||
_pbs = pbs;
|
||||
|
@ -1226,6 +1233,11 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
{
|
||||
|
||||
}
|
||||
public override PhysicsVector RotationalVelocity
|
||||
{
|
||||
get{ return m_rotationalVelocity;}
|
||||
set { m_rotationalVelocity = value; }
|
||||
}
|
||||
|
||||
public void UpdatePositionAndVelocity() {
|
||||
// no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit!
|
||||
|
@ -1234,6 +1246,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
d.Vector3 vec = d.BodyGetPosition(Body);
|
||||
d.Quaternion ori = d.BodyGetQuaternion(Body);
|
||||
d.Vector3 vel = d.BodyGetLinearVel(Body);
|
||||
d.Vector3 rotvel = d.BodyGetAngularVel(Body);
|
||||
|
||||
PhysicsVector l_position = new PhysicsVector();
|
||||
// kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!)
|
||||
if (vec.X < 0.0f) vec.X = 0.0f;
|
||||
|
@ -1271,6 +1285,9 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
_velocity.X = 0;
|
||||
_velocity.Y = 0;
|
||||
_velocity.Z = 0;
|
||||
m_rotationalVelocity.X = 0;
|
||||
m_rotationalVelocity.Y = 0;
|
||||
m_rotationalVelocity.Z = 0;
|
||||
_zeroFlag = true;
|
||||
}
|
||||
|
||||
|
@ -1293,11 +1310,13 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
_velocity.X = 0.0f;
|
||||
_velocity.Y = 0.0f;
|
||||
_velocity.Z = 0.0f;
|
||||
_orientation.w = 0f;
|
||||
_orientation.x = 0f;
|
||||
_orientation.y = 0f;
|
||||
_orientation.z = 0f;
|
||||
|
||||
//_orientation.w = 0f;
|
||||
//_orientation.x = 0f;
|
||||
//_orientation.y = 0f;
|
||||
//_orientation.z = 0f;
|
||||
m_rotationalVelocity.X = 0;
|
||||
m_rotationalVelocity.Y = 0;
|
||||
m_rotationalVelocity.Z = 0;
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -1310,6 +1329,10 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
_velocity.Y = vel.Y;
|
||||
_velocity.Z = vel.Z;
|
||||
|
||||
m_rotationalVelocity.X = rotvel.X;
|
||||
m_rotationalVelocity.Y = rotvel.Y;
|
||||
m_rotationalVelocity.Z = rotvel.Z;
|
||||
//System.Console.WriteLine("ODE: " + m_rotationalVelocity.ToString());
|
||||
_orientation.w = ori.W;
|
||||
_orientation.x = ori.X;
|
||||
_orientation.y = ori.Y;
|
||||
|
@ -1317,6 +1340,17 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not a body.. so Make sure the client isn't interpolating
|
||||
_velocity.X = 0;
|
||||
_velocity.Y = 0;
|
||||
_velocity.Z = 0;
|
||||
m_rotationalVelocity.X = 0;
|
||||
m_rotationalVelocity.Y = 0;
|
||||
m_rotationalVelocity.Z = 0;
|
||||
_zeroFlag = true;
|
||||
}
|
||||
|
||||
}
|
||||
public override void SetMomentum(PhysicsVector momentum)
|
||||
|
|
|
@ -184,6 +184,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
|||
{
|
||||
private PhysicsVector _position;
|
||||
private PhysicsVector _velocity;
|
||||
private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero;
|
||||
private PhysicsVector _acceleration;
|
||||
private NxCharacter _character;
|
||||
private bool flying;
|
||||
|
@ -214,7 +215,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
|||
get { return iscolliding; }
|
||||
set { iscolliding = value; }
|
||||
}
|
||||
|
||||
public override PhysicsVector RotationalVelocity
|
||||
{
|
||||
get { return m_rotationalVelocity; }
|
||||
set { m_rotationalVelocity = value; }
|
||||
}
|
||||
public override PhysicsVector Position
|
||||
{
|
||||
get { return _position; }
|
||||
|
@ -314,6 +319,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
|||
private PhysicsVector _position;
|
||||
private PhysicsVector _velocity;
|
||||
private PhysicsVector _acceleration;
|
||||
private PhysicsVector m_rotationalVelocity;
|
||||
private NxActor _prim;
|
||||
|
||||
public PhysXPrim(NxActor prim)
|
||||
|
@ -329,7 +335,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
|||
get { return false; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override PhysicsVector RotationalVelocity
|
||||
{
|
||||
get { return m_rotationalVelocity; }
|
||||
set { m_rotationalVelocity = value; }
|
||||
}
|
||||
public override bool Flying
|
||||
{
|
||||
get { return false; //no flying prims for you
|
||||
|
|
Loading…
Reference in New Issue