mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 09:45:47 +08:00
* A bunch of updates to make things more smooth.
** Sending the actual TimeDilation to the client now instead of the 62455 constant. The client is *supposed* to use that value to sync with the simulator. (actually sending ushort.maxvalue * TimeDilation) ** Disabling prim that inter-penetrate instead of just not attaching a joint ** Reduced prim spin a 'little' bit, but not *enough* ** Tweaked the TimeDilation algorithm to be closer to 1.0 by default and various changes to the sim stats reporter ** Created a .SetValues method to PhysicsVector so we can simply call the setvalues function instead of .x, .y, .z sets. ** Experimented with a .GetBytes Method on PhysicsActor to be able to use the LLVector3.FromBytes() method. ** Upped the Inter-penetration depth to 0.25 instead of .08.
This commit is contained in:
@@ -46,7 +46,12 @@ namespace OpenSim.Region.Physics.Manager
|
||||
Y = y;
|
||||
Z = z;
|
||||
}
|
||||
|
||||
public void setValues(float x, float y, float z)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
}
|
||||
public static readonly PhysicsVector Zero = new PhysicsVector(0f, 0f, 0f);
|
||||
|
||||
public override string ToString()
|
||||
@@ -54,6 +59,56 @@ namespace OpenSim.Region.Physics.Manager
|
||||
return "<" + X + "," + Y + "," + Z + ">";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// These routines are the easiest way to store XYZ values in an LLVector3 without requiring 3 calls.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public byte[] GetBytes()
|
||||
{
|
||||
byte[] byteArray = new byte[12];
|
||||
|
||||
Buffer.BlockCopy(BitConverter.GetBytes(X), 0, byteArray, 0, 4);
|
||||
Buffer.BlockCopy(BitConverter.GetBytes(Y), 0, byteArray, 4, 4);
|
||||
Buffer.BlockCopy(BitConverter.GetBytes(Z), 0, byteArray, 8, 4);
|
||||
|
||||
if (!BitConverter.IsLittleEndian)
|
||||
{
|
||||
Array.Reverse(byteArray, 0, 4);
|
||||
Array.Reverse(byteArray, 4, 4);
|
||||
Array.Reverse(byteArray, 8, 4);
|
||||
}
|
||||
|
||||
return byteArray;
|
||||
}
|
||||
|
||||
public void FromBytes(byte[] byteArray, int pos)
|
||||
{
|
||||
byte[] conversionBuffer = null;
|
||||
if (!BitConverter.IsLittleEndian)
|
||||
{
|
||||
// Big endian architecture
|
||||
if (conversionBuffer == null)
|
||||
conversionBuffer = new byte[12];
|
||||
|
||||
Buffer.BlockCopy(byteArray, pos, conversionBuffer, 0, 12);
|
||||
|
||||
Array.Reverse(conversionBuffer, 0, 4);
|
||||
Array.Reverse(conversionBuffer, 4, 4);
|
||||
Array.Reverse(conversionBuffer, 8, 4);
|
||||
|
||||
X = BitConverter.ToSingle(conversionBuffer, 0);
|
||||
Y = BitConverter.ToSingle(conversionBuffer, 4);
|
||||
Z = BitConverter.ToSingle(conversionBuffer, 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Little endian architecture
|
||||
X = BitConverter.ToSingle(byteArray, pos);
|
||||
Y = BitConverter.ToSingle(byteArray, pos + 4);
|
||||
Z = BitConverter.ToSingle(byteArray, pos + 8);
|
||||
}
|
||||
}
|
||||
|
||||
// Operations
|
||||
public static PhysicsVector operator +(PhysicsVector a, PhysicsVector b)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user