diff options
author | Teravus Ovares | 2008-02-12 04:27:20 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-02-12 04:27:20 +0000 |
commit | 6e01769bcff35be9cace62a0342cf2d275608891 (patch) | |
tree | 124df7910fc0f1d31a13e297ced2dd73ce91a292 /OpenSim/Region/Physics/Manager/PhysicsVector.cs | |
parent | default to appending for log files per Mantis 530, and per (diff) | |
download | opensim-SC_OLD-6e01769bcff35be9cace62a0342cf2d275608891.zip opensim-SC_OLD-6e01769bcff35be9cace62a0342cf2d275608891.tar.gz opensim-SC_OLD-6e01769bcff35be9cace62a0342cf2d275608891.tar.bz2 opensim-SC_OLD-6e01769bcff35be9cace62a0342cf2d275608891.tar.xz |
* 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.
Diffstat (limited to 'OpenSim/Region/Physics/Manager/PhysicsVector.cs')
-rw-r--r-- | OpenSim/Region/Physics/Manager/PhysicsVector.cs | 57 |
1 files changed, 56 insertions, 1 deletions
diff --git a/OpenSim/Region/Physics/Manager/PhysicsVector.cs b/OpenSim/Region/Physics/Manager/PhysicsVector.cs index 1f5d0dc..4b2e756 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsVector.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsVector.cs | |||
@@ -46,7 +46,12 @@ namespace OpenSim.Region.Physics.Manager | |||
46 | Y = y; | 46 | Y = y; |
47 | Z = z; | 47 | Z = z; |
48 | } | 48 | } |
49 | 49 | public void setValues(float x, float y, float z) | |
50 | { | ||
51 | X = x; | ||
52 | Y = y; | ||
53 | Z = z; | ||
54 | } | ||
50 | public static readonly PhysicsVector Zero = new PhysicsVector(0f, 0f, 0f); | 55 | public static readonly PhysicsVector Zero = new PhysicsVector(0f, 0f, 0f); |
51 | 56 | ||
52 | public override string ToString() | 57 | public override string ToString() |
@@ -54,6 +59,56 @@ namespace OpenSim.Region.Physics.Manager | |||
54 | return "<" + X + "," + Y + "," + Z + ">"; | 59 | return "<" + X + "," + Y + "," + Z + ">"; |
55 | } | 60 | } |
56 | 61 | ||
62 | /// <summary> | ||
63 | /// These routines are the easiest way to store XYZ values in an LLVector3 without requiring 3 calls. | ||
64 | /// </summary> | ||
65 | /// <returns></returns> | ||
66 | public byte[] GetBytes() | ||
67 | { | ||
68 | byte[] byteArray = new byte[12]; | ||
69 | |||
70 | Buffer.BlockCopy(BitConverter.GetBytes(X), 0, byteArray, 0, 4); | ||
71 | Buffer.BlockCopy(BitConverter.GetBytes(Y), 0, byteArray, 4, 4); | ||
72 | Buffer.BlockCopy(BitConverter.GetBytes(Z), 0, byteArray, 8, 4); | ||
73 | |||
74 | if (!BitConverter.IsLittleEndian) | ||
75 | { | ||
76 | Array.Reverse(byteArray, 0, 4); | ||
77 | Array.Reverse(byteArray, 4, 4); | ||
78 | Array.Reverse(byteArray, 8, 4); | ||
79 | } | ||
80 | |||
81 | return byteArray; | ||
82 | } | ||
83 | |||
84 | public void FromBytes(byte[] byteArray, int pos) | ||
85 | { | ||
86 | byte[] conversionBuffer = null; | ||
87 | if (!BitConverter.IsLittleEndian) | ||
88 | { | ||
89 | // Big endian architecture | ||
90 | if (conversionBuffer == null) | ||
91 | conversionBuffer = new byte[12]; | ||
92 | |||
93 | Buffer.BlockCopy(byteArray, pos, conversionBuffer, 0, 12); | ||
94 | |||
95 | Array.Reverse(conversionBuffer, 0, 4); | ||
96 | Array.Reverse(conversionBuffer, 4, 4); | ||
97 | Array.Reverse(conversionBuffer, 8, 4); | ||
98 | |||
99 | X = BitConverter.ToSingle(conversionBuffer, 0); | ||
100 | Y = BitConverter.ToSingle(conversionBuffer, 4); | ||
101 | Z = BitConverter.ToSingle(conversionBuffer, 8); | ||
102 | } | ||
103 | else | ||
104 | { | ||
105 | // Little endian architecture | ||
106 | X = BitConverter.ToSingle(byteArray, pos); | ||
107 | Y = BitConverter.ToSingle(byteArray, pos + 4); | ||
108 | Z = BitConverter.ToSingle(byteArray, pos + 8); | ||
109 | } | ||
110 | } | ||
111 | |||
57 | // Operations | 112 | // Operations |
58 | public static PhysicsVector operator +(PhysicsVector a, PhysicsVector b) | 113 | public static PhysicsVector operator +(PhysicsVector a, PhysicsVector b) |
59 | { | 114 | { |