aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMW2007-03-10 20:30:25 +0000
committerMW2007-03-10 20:30:25 +0000
commit76569ff4fba09f22ed4a06b8073deaed7f64a2e3 (patch)
treef83430652d8874f299733f505b6b7ded13910bb8
parentAnother attempt to fix the project files (diff)
downloadopensim-SC_OLD-76569ff4fba09f22ed4a06b8073deaed7f64a2e3.zip
opensim-SC_OLD-76569ff4fba09f22ed4a06b8073deaed7f64a2e3.tar.gz
opensim-SC_OLD-76569ff4fba09f22ed4a06b8073deaed7f64a2e3.tar.bz2
opensim-SC_OLD-76569ff4fba09f22ed4a06b8073deaed7f64a2e3.tar.xz
A PhysX physics plugin (that actually uses physX now but currently only works on windows)
Can now change direction when walking without stopping Flying works when using the Physx dll
-rw-r--r--bin/PhysX-wrapper.dllbin0 -> 53248 bytes
-rw-r--r--bin/PhysX_Wrapper_Dotnet.dllbin0 -> 6656 bytes
-rw-r--r--src/Main.cs8
-rw-r--r--src/OpenSimClient.cs7
-rw-r--r--src/Second-server.sln10
-rw-r--r--src/physics/PhysicsManager.cs7
-rw-r--r--src/physics/RealPhysX/RealPhysXplugin/AssemblyInfo.cs31
-rw-r--r--src/physics/RealPhysX/RealPhysXplugin/RealPhysX.cs361
-rw-r--r--src/physics/RealPhysX/RealPhysXplugin/RealPhysXplugin.csproj45
-rw-r--r--src/physics/RealPhysX/RealPhysXplugin/RealPhysXplugin.sln7
-rw-r--r--src/physics/plugins/PhysXplugin.cs38
-rw-r--r--src/world/Avatar.cs103
-rw-r--r--src/world/Primitive.cs83
-rw-r--r--src/world/World.cs9
14 files changed, 674 insertions, 35 deletions
diff --git a/bin/PhysX-wrapper.dll b/bin/PhysX-wrapper.dll
new file mode 100644
index 0000000..73d8b91
--- /dev/null
+++ b/bin/PhysX-wrapper.dll
Binary files differ
diff --git a/bin/PhysX_Wrapper_Dotnet.dll b/bin/PhysX_Wrapper_Dotnet.dll
new file mode 100644
index 0000000..1e97cb5
--- /dev/null
+++ b/bin/PhysX_Wrapper_Dotnet.dll
Binary files differ
diff --git a/src/Main.cs b/src/Main.cs
index 600ce38..3103ea3 100644
--- a/src/Main.cs
+++ b/src/Main.cs
@@ -71,6 +71,7 @@ namespace OpenSim
71 private PhysicsManager physManager; 71 private PhysicsManager physManager;
72 private System.Timers.Timer timer1 = new System.Timers.Timer(); 72 private System.Timers.Timer timer1 = new System.Timers.Timer();
73 private string ConfigDll = "SimConfig.dll"; 73 private string ConfigDll = "SimConfig.dll";
74 private string _physicsEngine = "PhysX";
74 public bool sandbox = false; 75 public bool sandbox = false;
75 public bool loginserver = false; 76 public bool loginserver = false;
76 77
@@ -93,6 +94,11 @@ namespace OpenSim
93 { 94 {
94 sim.loginserver = true; 95 sim.loginserver = true;
95 } 96 }
97 if(args[i] == "-realphysx")
98 {
99 sim._physicsEngine = "RealPhysX";
100 OpenSim.world.Avatar.PhysicsEngineFlying = true;
101 }
96 } 102 }
97 103
98 OpenSim_Main.gridServers = new Grid(); 104 OpenSim_Main.gridServers = new Grid();
@@ -148,7 +154,7 @@ namespace OpenSim
148 this.physManager = new PhysicsSystem.PhysicsManager(); 154 this.physManager = new PhysicsSystem.PhysicsManager();
149 this.physManager.LoadPlugins(); 155 this.physManager.LoadPlugins();
150 ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting up messaging system"); 156 ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting up messaging system");
151 local_world.PhysScene = this.physManager.GetPhysicsScene("PhysX"); //should be reading from the config file what physics engine to use 157 local_world.PhysScene = this.physManager.GetPhysicsScene(this._physicsEngine); //should be reading from the config file what physics engine to use
152 local_world.PhysScene.SetTerrain(local_world.LandMap); 158 local_world.PhysScene.SetTerrain(local_world.LandMap);
153 159
154 OpenSim_Main.gridServers.AssetServer.SetServerInfo(OpenSim_Main.cfg.AssetURL, OpenSim_Main.cfg.AssetSendKey); 160 OpenSim_Main.gridServers.AssetServer.SetServerInfo(OpenSim_Main.cfg.AssetURL, OpenSim_Main.cfg.AssetSendKey);
diff --git a/src/OpenSimClient.cs b/src/OpenSimClient.cs
index 50d8c78..dd698e4 100644
--- a/src/OpenSimClient.cs
+++ b/src/OpenSimClient.cs
@@ -135,8 +135,8 @@ namespace OpenSim
135 { 135 {
136 if(ent.localid == multipleupdate.ObjectData[ i ].ObjectLocalID) 136 if(ent.localid == multipleupdate.ObjectData[ i ].ObjectLocalID)
137 { 137 {
138 ent.position = pos; 138 ((OpenSim.world.Primitive)ent).UpdatePosition( pos);
139 ((OpenSim.world.Primitive)ent).UpdateFlag = true; 139
140 } 140 }
141 } 141 }
142 142
@@ -191,6 +191,7 @@ namespace OpenSim
191 OpenSim_Main.local_world.Entities.Remove(this.AgentID); 191 OpenSim_Main.local_world.Entities.Remove(this.AgentID);
192 } 192 }
193 //need to do other cleaning up here too 193 //need to do other cleaning up here too
194 OpenSim_Main.sim.ClientThreads.Remove(this.userEP);
194 this.ClientThread.Abort(); 195 this.ClientThread.Abort();
195 break; 196 break;
196 case PacketType.ChatFromViewer: 197 case PacketType.ChatFromViewer:
@@ -222,7 +223,7 @@ namespace OpenSim
222 { 223 {
223 foreach (Packet packet in NeedAck.Values) 224 foreach (Packet packet in NeedAck.Values)
224 { 225 {
225 if (now - packet.TickCount > RESEND_TIMEOUT) 226 if ((now - packet.TickCount > RESEND_TIMEOUT) && (!packet.Header.Resent))
226 { 227 {
227 ServerConsole.MainConsole.Instance.WriteLine("Resending " + packet.Type.ToString() + " packet, " + 228 ServerConsole.MainConsole.Instance.WriteLine("Resending " + packet.Type.ToString() + " packet, " +
228 (now - packet.TickCount) + "ms have passed"); 229 (now - packet.TickCount) + "ms have passed");
diff --git a/src/Second-server.sln b/src/Second-server.sln
index a460b2a..17c807f 100644
--- a/src/Second-server.sln
+++ b/src/Second-server.sln
@@ -19,6 +19,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServerConsole", "ServerCons
19EndProject 19EndProject
20Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Db4LocalStorage", "LocalStorage\Db4LocalStorage\Db4LocalStorage.csproj", "{74784F23-B0FD-484C-82C1-96C0215733DC}" 20Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Db4LocalStorage", "LocalStorage\Db4LocalStorage\Db4LocalStorage.csproj", "{74784F23-B0FD-484C-82C1-96C0215733DC}"
21EndProject 21EndProject
22Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RealPhysXplugin", "physics\RealPhysX\RealPhysXplugin\RealPhysXplugin.csproj", "{56C1D214-F389-4228-921A-0A3A0712C159}"
23EndProject
22Global 24Global
23 GlobalSection(SolutionConfigurationPlatforms) = preSolution 25 GlobalSection(SolutionConfigurationPlatforms) = preSolution
24 Debug|.NET 1.1 = Debug|.NET 1.1 26 Debug|.NET 1.1 = Debug|.NET 1.1
@@ -99,6 +101,14 @@ Global
99 {74784F23-B0FD-484C-82C1-96C0215733DC}.Release|.NET 1.1.ActiveCfg = Release|.NET 1.1 101 {74784F23-B0FD-484C-82C1-96C0215733DC}.Release|.NET 1.1.ActiveCfg = Release|.NET 1.1
100 {74784F23-B0FD-484C-82C1-96C0215733DC}.Release|Any CPU.Build.0 = Release|Any CPU 102 {74784F23-B0FD-484C-82C1-96C0215733DC}.Release|Any CPU.Build.0 = Release|Any CPU
101 {74784F23-B0FD-484C-82C1-96C0215733DC}.Release|Any CPU.ActiveCfg = Release|Any CPU 103 {74784F23-B0FD-484C-82C1-96C0215733DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
104 {56C1D214-F389-4228-921A-0A3A0712C159}.Debug|.NET 1.1.Build.0 = Debug|.NET 1.1
105 {56C1D214-F389-4228-921A-0A3A0712C159}.Debug|.NET 1.1.ActiveCfg = Debug|.NET 1.1
106 {56C1D214-F389-4228-921A-0A3A0712C159}.Debug|Any CPU.Build.0 = Debug|Any CPU
107 {56C1D214-F389-4228-921A-0A3A0712C159}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
108 {56C1D214-F389-4228-921A-0A3A0712C159}.Release|.NET 1.1.Build.0 = Release|.NET 1.1
109 {56C1D214-F389-4228-921A-0A3A0712C159}.Release|.NET 1.1.ActiveCfg = Release|.NET 1.1
110 {56C1D214-F389-4228-921A-0A3A0712C159}.Release|Any CPU.Build.0 = Release|Any CPU
111 {56C1D214-F389-4228-921A-0A3A0712C159}.Release|Any CPU.ActiveCfg = Release|Any CPU
102 EndGlobalSection 112 EndGlobalSection
103 GlobalSection(SolutionProperties) = preSolution 113 GlobalSection(SolutionProperties) = preSolution
104 HideSolutionNode = FALSE 114 HideSolutionNode = FALSE
diff --git a/src/physics/PhysicsManager.cs b/src/physics/PhysicsManager.cs
index 0986501..e5d5bd6 100644
--- a/src/physics/PhysicsManager.cs
+++ b/src/physics/PhysicsManager.cs
@@ -110,6 +110,8 @@ namespace PhysicsSystem
110 { 110 {
111 public abstract PhysicsActor AddAvatar(PhysicsVector position); 111 public abstract PhysicsActor AddAvatar(PhysicsVector position);
112 112
113 public abstract PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size);
114
113 public abstract void Simulate(float timeStep); 115 public abstract void Simulate(float timeStep);
114 116
115 public abstract void GetResults(); 117 public abstract void GetResults();
@@ -140,6 +142,11 @@ namespace PhysicsSystem
140 { 142 {
141 get; 143 get;
142 } 144 }
145 public abstract bool Flying
146 {
147 get;
148 set;
149 }
143 150
144 public abstract void AddForce(PhysicsVector force); 151 public abstract void AddForce(PhysicsVector force);
145 152
diff --git a/src/physics/RealPhysX/RealPhysXplugin/AssemblyInfo.cs b/src/physics/RealPhysX/RealPhysXplugin/AssemblyInfo.cs
new file mode 100644
index 0000000..913aae7
--- /dev/null
+++ b/src/physics/RealPhysX/RealPhysXplugin/AssemblyInfo.cs
@@ -0,0 +1,31 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// Information about this assembly is defined by the following
6// attributes.
7//
8// change them to the information which is associated with the assembly
9// you compile.
10
11[assembly: AssemblyTitle("RealPhysXplugin")]
12[assembly: AssemblyDescription("")]
13[assembly: AssemblyConfiguration("")]
14[assembly: AssemblyCompany("")]
15[assembly: AssemblyProduct("RealPhysXplugin")]
16[assembly: AssemblyCopyright("")]
17[assembly: AssemblyTrademark("")]
18[assembly: AssemblyCulture("")]
19
20// This sets the default COM visibility of types in the assembly to invisible.
21// If you need to expose a type to COM, use [ComVisible(true)] on that type.
22[assembly: ComVisible(false)]
23
24// The assembly version has following format :
25//
26// Major.Minor.Build.Revision
27//
28// You can specify all values by your own or you can build default build and revision
29// numbers with the '*' character (the default):
30
31[assembly: AssemblyVersion("1.0.*")]
diff --git a/src/physics/RealPhysX/RealPhysXplugin/RealPhysX.cs b/src/physics/RealPhysX/RealPhysXplugin/RealPhysX.cs
new file mode 100644
index 0000000..9576a40
--- /dev/null
+++ b/src/physics/RealPhysX/RealPhysXplugin/RealPhysX.cs
@@ -0,0 +1,361 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
27/*
28* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
29*
30* Redistribution and use in source and binary forms, with or without
31* modification, are permitted provided that the following conditions are met:
32* * Redistributions of source code must retain the above copyright
33* notice, this list of conditions and the following disclaimer.
34* * Redistributions in binary form must reproduce the above copyright
35* notice, this list of conditions and the following disclaimer in the
36* documentation and/or other materials provided with the distribution.
37* * Neither the name of the <organization> nor the
38* names of its contributors may be used to endorse or promote products
39* derived from this software without specific prior written permission.
40*
41* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
42* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
43* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
44* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
45* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
46* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
47* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
48* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
49* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
50* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51*
52*/
53using System;
54using System.Collections.Generic;
55using PhysicsSystem;
56using PhysXWrapper;
57
58namespace PhysXplugin
59{
60 /// <summary>
61 /// Will be the PhysX plugin but for now will be a very basic physics engine
62 /// </summary>
63 public class PhysXPlugin : IPhysicsPlugin
64 {
65 private PhysXScene _mScene;
66
67 public PhysXPlugin()
68 {
69
70 }
71
72 public bool Init()
73 {
74 return true;
75 }
76
77 public PhysicsScene GetScene()
78 {
79 if(_mScene == null)
80 {
81 _mScene = new PhysXScene();
82 }
83 return(_mScene);
84 }
85
86 public string GetName()
87 {
88 return("RealPhysX");
89 }
90
91 public void Dispose()
92 {
93
94 }
95 }
96
97 public class PhysXScene :PhysicsScene
98 {
99 private List<PhysXCharacter> _characters = new List<PhysXCharacter>();
100 private List<PhysXPrim> _prims = new List<PhysXPrim>();
101 private float[] _heightMap;
102 private NxPhysicsSDK mySdk;
103 private NxScene scene;
104
105 public PhysXScene()
106 {
107 mySdk = NxPhysicsSDK.CreateSDK();
108 scene = mySdk.CreateScene();
109
110 }
111
112 public override PhysicsActor AddAvatar(PhysicsVector position)
113 {
114 Vec3 pos = new Vec3();
115 pos.X = position.X;
116 pos.Y = position.Y;
117 pos.Z = position.Z;
118 PhysXCharacter act = new PhysXCharacter( scene.AddCharacter(pos));
119 act.Position = position;
120 _characters.Add(act);
121 return act;
122 }
123
124 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size)
125 {
126 Vec3 pos = new Vec3();
127 pos.X = position.X;
128 pos.Y = position.Y;
129 pos.Z = position.Z;
130 Vec3 siz = new Vec3();
131 siz.X = size.X;
132 siz.Y = size.Y;
133 siz.Z = size.Z;
134 PhysXPrim act = new PhysXPrim( scene.AddNewBox(pos, siz));
135 _prims.Add(act);
136 return act;
137 }
138 public override void Simulate(float timeStep)
139 {
140 foreach (PhysXCharacter actor in _characters)
141 {
142 actor.Move(timeStep);
143 }
144 scene.Simulate(timeStep);
145 scene.FetchResults();
146 scene.UpdateControllers();
147
148 foreach (PhysXCharacter actor in _characters)
149 {
150 actor.UpdatePosition();
151 }
152
153 }
154
155 public override void GetResults()
156 {
157
158 }
159
160 public override bool IsThreaded
161 {
162 get
163 {
164 return(false); // for now we won't be multithreaded
165 }
166 }
167
168 public override void SetTerrain(float[] heightMap)
169 {
170 this._heightMap = heightMap;
171 this.scene.AddTerrain(heightMap);
172 }
173 }
174
175 public class PhysXCharacter : PhysicsActor
176 {
177 private PhysicsVector _position;
178 private PhysicsVector _velocity;
179 private PhysicsVector _acceleration;
180 private NxCharacter _character;
181 private bool flying;
182
183 public PhysXCharacter(NxCharacter character)
184 {
185 _velocity = new PhysicsVector();
186 _position = new PhysicsVector();
187 _acceleration = new PhysicsVector();
188 _character = character;
189 }
190
191 public override bool Flying
192 {
193 get
194 {
195 return flying;
196 }
197 set
198 {
199 flying = value;
200 }
201 }
202
203 public override PhysicsVector Position
204 {
205 get
206 {
207 return _position;
208 }
209 set
210 {
211 _position = value;
212 }
213 }
214
215 public override PhysicsVector Velocity
216 {
217 get
218 {
219 return _velocity;
220 }
221 set
222 {
223 _velocity = value;
224 }
225 }
226
227 public override PhysicsVector Acceleration
228 {
229 get
230 {
231 return _acceleration;
232 }
233
234 }
235 public void SetAcceleration (PhysicsVector accel)
236 {
237 this._acceleration = accel;
238 }
239
240 public override void AddForce(PhysicsVector force)
241 {
242
243 }
244
245 public override void SetMomentum(PhysicsVector momentum)
246 {
247
248 }
249
250 public void Move(float timeStep)
251 {
252 Vec3 vec = new Vec3();
253 vec.X = this._velocity.X * timeStep;
254 vec.Y = this._velocity.Y * timeStep;
255 if(flying)
256 {
257 vec.Z = ( this._velocity.Z) * timeStep;
258 }
259 else
260 {
261 vec.Z = (-9.8f + this._velocity.Z) * timeStep;
262 }
263 this._character.Move(vec);
264 }
265
266 public void UpdatePosition()
267 {
268 Vec3 vec = this._character.Position;
269 this._position.X = vec.X;
270 this._position.Y = vec.Y;
271 this._position.Z = vec.Z;
272 }
273 }
274
275 public class PhysXPrim : PhysicsActor
276 {
277 private PhysicsVector _position;
278 private PhysicsVector _velocity;
279 private PhysicsVector _acceleration;
280 private NxActor _prim;
281
282 public PhysXPrim(NxActor prim)
283 {
284 _velocity = new PhysicsVector();
285 _position = new PhysicsVector();
286 _acceleration = new PhysicsVector();
287 _prim = prim;
288 }
289 public override bool Flying
290 {
291 get
292 {
293 return false; //no flying prims for you
294 }
295 set
296 {
297
298 }
299 }
300 public override PhysicsVector Position
301 {
302 get
303 {
304 PhysicsVector pos = new PhysicsVector();
305 Vec3 vec = this._prim.Position;
306 pos.X = vec.X;
307 pos.Y = vec.Y;
308 pos.Z = vec.Z;
309 return pos;
310
311 }
312 set
313 {
314 PhysicsVector vec = value;
315 Vec3 pos = new Vec3();
316 pos.X = vec.X;
317 pos.Y = vec.Y;
318 pos.Z = vec.Z;
319 this._prim.Position = pos;
320 }
321 }
322
323 public override PhysicsVector Velocity
324 {
325 get
326 {
327 return _velocity;
328 }
329 set
330 {
331 _velocity = value;
332 }
333 }
334
335 public override PhysicsVector Acceleration
336 {
337 get
338 {
339 return _acceleration;
340 }
341
342 }
343 public void SetAcceleration (PhysicsVector accel)
344 {
345 this._acceleration = accel;
346 }
347
348 public override void AddForce(PhysicsVector force)
349 {
350
351 }
352
353 public override void SetMomentum(PhysicsVector momentum)
354 {
355
356 }
357
358
359 }
360
361}
diff --git a/src/physics/RealPhysX/RealPhysXplugin/RealPhysXplugin.csproj b/src/physics/RealPhysX/RealPhysXplugin/RealPhysXplugin.csproj
new file mode 100644
index 0000000..ae7bb79
--- /dev/null
+++ b/src/physics/RealPhysX/RealPhysXplugin/RealPhysXplugin.csproj
@@ -0,0 +1,45 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <OutputType>Library</OutputType>
4 <RootNamespace>RealPhysXplugin</RootNamespace>
5 <AssemblyName>RealPhysXplugin</AssemblyName>
6 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
7 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
8 <ProjectGuid>{56C1D214-F389-4228-921A-0A3A0712C159}</ProjectGuid>
9 </PropertyGroup>
10 <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
11 <OutputPath>bin\Debug\</OutputPath>
12 <Optimize>False</Optimize>
13 <DefineConstants>DEBUG;TRACE</DefineConstants>
14 <DebugSymbols>True</DebugSymbols>
15 <DebugType>Full</DebugType>
16 <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
17 </PropertyGroup>
18 <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
19 <OutputPath>bin\Release\</OutputPath>
20 <Optimize>True</Optimize>
21 <DefineConstants>TRACE</DefineConstants>
22 <DebugSymbols>False</DebugSymbols>
23 <DebugType>None</DebugType>
24 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
25 </PropertyGroup>
26 <ItemGroup>
27 <Reference Include="System" />
28 <Reference Include="System.Xml" />
29 <Reference Include="PhysX_Wrapper_Dotnet">
30 <HintPath>..\..\..\..\bin\PhysX_Wrapper_Dotnet.dll</HintPath>
31 <SpecificVersion>False</SpecificVersion>
32 </Reference>
33 </ItemGroup>
34 <ItemGroup>
35 <Compile Include="RealPhysX.cs" />
36 <Compile Include="AssemblyInfo.cs" />
37 </ItemGroup>
38 <ItemGroup>
39 <ProjectReference Include="..\..\PhysicsManager.csproj">
40 <Project>{3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}</Project>
41 <Name>PhysicsManager</Name>
42 </ProjectReference>
43 </ItemGroup>
44 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
45</Project> \ No newline at end of file
diff --git a/src/physics/RealPhysX/RealPhysXplugin/RealPhysXplugin.sln b/src/physics/RealPhysX/RealPhysXplugin/RealPhysXplugin.sln
new file mode 100644
index 0000000..34f87e6
--- /dev/null
+++ b/src/physics/RealPhysX/RealPhysXplugin/RealPhysXplugin.sln
@@ -0,0 +1,7 @@
1
2Microsoft Visual Studio Solution File, Format Version 9.00
3# SharpDevelop 2.1.0.2017
4Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RealPhysXplugin", "RealPhysXplugin.csproj", "{56C1D214-F389-4228-921A-0A3A0712C159}"
5EndProject
6Global
7EndGlobal
diff --git a/src/physics/plugins/PhysXplugin.cs b/src/physics/plugins/PhysXplugin.cs
index 58a82fb..8c09dc8 100644
--- a/src/physics/plugins/PhysXplugin.cs
+++ b/src/physics/plugins/PhysXplugin.cs
@@ -85,14 +85,30 @@ namespace PhysXplugin
85 return act; 85 return act;
86 } 86 }
87 87
88 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size)
89 {
90 return null;
91 }
92
88 public override void Simulate(float timeStep) 93 public override void Simulate(float timeStep)
89 { 94 {
90 foreach (PhysXActor actor in _actors) 95 foreach (PhysXActor actor in _actors)
91 { 96 {
92 actor.Position.X = actor.Position.X + actor.Velocity.X * timeStep; 97 actor.Position.X = actor.Position.X + (actor.Velocity.X * timeStep);
93 actor.Position.Y = actor.Position.Y + actor.Velocity.Y * timeStep; 98 actor.Position.Y = actor.Position.Y + (actor.Velocity.Y * timeStep);
94 actor.Position.Z = actor.Position.Z + actor.Velocity.Z * timeStep; 99 actor.Position.Z = actor.Position.Z + (actor.Velocity.Z * timeStep);
95 actor.Position.Z = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X]+1; 100 /*if(actor.Flying)
101 {
102 actor.Position.Z = actor.Position.Z + (actor.Velocity.Z * timeStep);
103 }
104 else
105 {
106 actor.Position.Z = actor.Position.Z + ((-9.8f + actor.Velocity.Z) * timeStep);
107 }
108 if(actor.Position.Z < (_heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X]+1))
109 {*/
110 actor.Position.Z = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X]+1;
111 //}
96 if(actor.Position.X<0) 112 if(actor.Position.X<0)
97 { 113 {
98 actor.Position.X = 0; 114 actor.Position.X = 0;
@@ -140,7 +156,7 @@ namespace PhysXplugin
140 private PhysicsVector _position; 156 private PhysicsVector _position;
141 private PhysicsVector _velocity; 157 private PhysicsVector _velocity;
142 private PhysicsVector _acceleration; 158 private PhysicsVector _acceleration;
143 159 private bool flying;
144 public PhysXActor() 160 public PhysXActor()
145 { 161 {
146 _velocity = new PhysicsVector(); 162 _velocity = new PhysicsVector();
@@ -148,6 +164,18 @@ namespace PhysXplugin
148 _acceleration = new PhysicsVector(); 164 _acceleration = new PhysicsVector();
149 } 165 }
150 166
167 public override bool Flying
168 {
169 get
170 {
171 return false;
172 }
173 set
174 {
175 flying= value;
176 }
177 }
178
151 public override PhysicsVector Position 179 public override PhysicsVector Position
152 { 180 {
153 get 181 get
diff --git a/src/world/Avatar.cs b/src/world/Avatar.cs
index c09c008..facfeee 100644
--- a/src/world/Avatar.cs
+++ b/src/world/Avatar.cs
@@ -11,15 +11,17 @@ namespace OpenSim.world
11{ 11{
12 public class Avatar : Entity 12 public class Avatar : Entity
13 { 13 {
14 public static bool PhysicsEngineFlying;
14 public string firstname; 15 public string firstname;
15 public string lastname; 16 public string lastname;
16 public OpenSimClient ControllingClient; 17 public OpenSimClient ControllingClient;
17 private PhysicsActor _physActor; 18 private PhysicsActor _physActor;
18 private static libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate; 19 private static libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate;
19 private bool updateflag; 20 private bool updateflag;
20 private bool walking; 21 private byte movementflag;
21 private List<NewForce> forcesList = new List<NewForce>(); 22 private List<NewForce> forcesList = new List<NewForce>();
22 private short _updateCount; 23 private short _updateCount;
24 private Axiom.MathLib.Quaternion bodyRot;
23 25
24 public Avatar(OpenSimClient TheClient) { 26 public Avatar(OpenSimClient TheClient) {
25 ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)"); 27 ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)");
@@ -77,14 +79,14 @@ namespace OpenSim.world
77 } 79 }
78 80
79 updateflag =false; 81 updateflag =false;
80 this._updateCount = 0; 82 //this._updateCount = 0;
81 } 83 }
82 else 84 else
83 { 85 {
84 if(walking) 86 //if((movementflag & 1) !=0)
85 { 87 //{
86 _updateCount++; 88 _updateCount++;
87 if(_updateCount>3) 89 if(( (!PhysicsEngineFlying) && (_updateCount>3)) || (_updateCount>0))
88 { 90 {
89 //It has been a while since last update was sent so lets send one. 91 //It has been a while since last update was sent so lets send one.
90 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); 92 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock();
@@ -98,7 +100,7 @@ namespace OpenSim.world
98 } 100 }
99 _updateCount = 0; 101 _updateCount = 0;
100 } 102 }
101 } 103 //}
102 } 104 }
103 } 105 }
104 106
@@ -249,36 +251,111 @@ namespace OpenSim.world
249 } 251 }
250 252
251 public void HandleUpdate(AgentUpdatePacket pack) { 253 public void HandleUpdate(AgentUpdatePacket pack) {
252 if(((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_POS) !=0) { 254 if(((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_FLY) !=0)
253 if(!walking) 255 {
256 this._physActor.Flying = true;
257 }
258 else
259 {
260 this._physActor.Flying = false;
261 }
262 if(((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_POS) !=0) {
263 Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(pack.AgentData.BodyRotation.W, pack.AgentData.BodyRotation.X, pack.AgentData.BodyRotation.Y, pack.AgentData.BodyRotation.Z);
264 if(((movementflag & 1) ==0) || (q!= this.bodyRot))
254 { 265 {
255 //we should add a new force to the list 266 //we should add a new force to the list
256 // but for now we will deal with velocities 267 // but for now we will deal with velocities
257 NewForce newVelocity = new NewForce(); 268 NewForce newVelocity = new NewForce();
258 Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(1, 0, 0); 269 Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(1, 0, 0);
259 Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(pack.AgentData.BodyRotation.W, pack.AgentData.BodyRotation.X, pack.AgentData.BodyRotation.Y, pack.AgentData.BodyRotation.Z);
260 Axiom.MathLib.Vector3 direc = q * v3; 270 Axiom.MathLib.Vector3 direc = q * v3;
261 direc.Normalize(); 271 direc.Normalize();
262 272
263 //work out velocity for sim physics system 273 //work out velocity for sim physics system
264 direc = direc * ((0.03f) * 128f); 274 direc = direc * ((0.03f) * 128f);
275 if(this._physActor.Flying)
276 direc *=2;
277
278 newVelocity.X = direc.x;
279 newVelocity.Y = direc.y;
280 newVelocity.Z = direc.z;
281 this.forcesList.Add(newVelocity);
282 movementflag = 1;
283 this.bodyRot = q;
284 }
285 }
286 else if((((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_UP_POS) !=0) &&(PhysicsEngineFlying)) {
287 if(((movementflag & 2) ==0) && this._physActor.Flying)
288 {
289 //we should add a new force to the list
290 // but for now we will deal with velocities
291 NewForce newVelocity = new NewForce();
292 Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(0, 0, 1);
293 Axiom.MathLib.Vector3 direc = v3;
294 direc.Normalize();
295
296 //work out velocity for sim physics system
297 direc = direc * ((0.03f) * 128f *2);
298 newVelocity.X = direc.x;
299 newVelocity.Y = direc.y;
300 newVelocity.Z = direc.z;
301 this.forcesList.Add(newVelocity);
302 movementflag = 2;
303 }
304 }
305 else if((((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_UP_NEG) !=0) && (PhysicsEngineFlying)) {
306 if(((movementflag & 4) ==0) && this._physActor.Flying)
307 {
308 //we should add a new force to the list
309 // but for now we will deal with velocities
310 NewForce newVelocity = new NewForce();
311 Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(0, 0, -1);
312 //Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(pack.AgentData.BodyRotation.W, pack.AgentData.BodyRotation.X, pack.AgentData.BodyRotation.Y, pack.AgentData.BodyRotation.Z);
313 Axiom.MathLib.Vector3 direc = v3;
314 direc.Normalize();
315
316 //work out velocity for sim physics system
317 direc = direc * ((0.03f) * 128f *2);
318 newVelocity.X = direc.x;
319 newVelocity.Y = direc.y;
320 newVelocity.Z = direc.z;
321 this.forcesList.Add(newVelocity);
322 movementflag = 4;
323 }
324 }
325 else if(((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_NEG) !=0) {
326 Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(pack.AgentData.BodyRotation.W, pack.AgentData.BodyRotation.X, pack.AgentData.BodyRotation.Y, pack.AgentData.BodyRotation.Z);
327 if(((movementflag & 8) ==0) || (q!= this.bodyRot))
328 {
329 //we should add a new force to the list
330 // but for now we will deal with velocities
331 NewForce newVelocity = new NewForce();
332 Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(-1, 0, 0);
333 Axiom.MathLib.Vector3 direc = q * v3;
334 direc.Normalize();
335
336 //work out velocity for sim physics system
337 direc = direc * ((0.03f) * 128f);
338 if(this._physActor.Flying)
339 direc *=2;
340
265 newVelocity.X = direc.x; 341 newVelocity.X = direc.x;
266 newVelocity.Y = direc.y; 342 newVelocity.Y = direc.y;
267 newVelocity.Z = direc.z; 343 newVelocity.Z = direc.z;
268 this.forcesList.Add(newVelocity); 344 this.forcesList.Add(newVelocity);
269 walking=true; 345 movementflag = 8;
346 this.bodyRot = q;
270 } 347 }
271 } 348 }
272 else 349 else
273 { 350 {
274 if(walking) 351 if((movementflag) !=0)
275 { 352 {
276 NewForce newVelocity = new NewForce(); 353 NewForce newVelocity = new NewForce();
277 newVelocity.X = 0; 354 newVelocity.X = 0;
278 newVelocity.Y = 0; 355 newVelocity.Y = 0;
279 newVelocity.Z = 0; 356 newVelocity.Z = 0;
280 this.forcesList.Add(newVelocity); 357 this.forcesList.Add(newVelocity);
281 walking = false; 358 movementflag = 0;
282 } 359 }
283 } 360 }
284 } 361 }
diff --git a/src/world/Primitive.cs b/src/world/Primitive.cs
index 0d7d951..6be33ef 100644
--- a/src/world/Primitive.cs
+++ b/src/world/Primitive.cs
@@ -5,6 +5,7 @@ using OpenSim.types;
5using libsecondlife; 5using libsecondlife;
6using libsecondlife.Packets; 6using libsecondlife.Packets;
7using GridInterfaces; 7using GridInterfaces;
8using PhysicsSystem;
8 9
9namespace OpenSim.world 10namespace OpenSim.world
10{ 11{
@@ -16,8 +17,21 @@ namespace OpenSim.world
16 protected bool newPrimFlag; 17 protected bool newPrimFlag;
17 protected bool updateFlag; 18 protected bool updateFlag;
18 protected bool dirtyFlag; 19 protected bool dirtyFlag;
19 protected ObjectUpdatePacket OurPacket; 20 private ObjectUpdatePacket OurPacket;
21 private PhysicsActor _physActor;
22 private bool physicsEnabled;
20 23
24 public bool PhysicsEnabled
25 {
26 get
27 {
28 return physicsEnabled;
29 }
30 set
31 {
32 physicsEnabled = value;
33 }
34 }
21 public bool UpdateFlag 35 public bool UpdateFlag
22 { 36 {
23 get 37 get
@@ -41,6 +55,14 @@ namespace OpenSim.world
41 return this.primData.Scale; 55 return this.primData.Scale;
42 } 56 }
43 } 57 }
58 public PhysicsActor PhysActor
59 {
60 set
61 {
62 this._physActor = value;
63 }
64 }
65
44 public Primitive() 66 public Primitive()
45 { 67 {
46 mesh_cutbegin = 0.0f; 68 mesh_cutbegin = 0.0f;
@@ -61,6 +83,16 @@ namespace OpenSim.world
61 return mesh; 83 return mesh;
62 } 84 }
63 85
86 public void UpdatePosition( LLVector3 pos)
87 {
88 this.position = pos;
89 if(this._physActor != null && this.physicsEnabled)
90 {
91 this._physActor.Position = new PhysicsVector(pos.X, pos.Y, pos.Z);
92 }
93 this.updateFlag = true;
94 }
95
64 public override void update() 96 public override void update()
65 { 97 {
66 if(this.newPrimFlag) 98 if(this.newPrimFlag)
@@ -89,13 +121,39 @@ namespace OpenSim.world
89 } 121 }
90 this.dirtyFlag = false; 122 this.dirtyFlag = false;
91 } 123 }
92 124 else
125 {
126 if(this._physActor != null && this.physicsEnabled)
127 {
128 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
129 terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME
130 terse.RegionData.TimeDilation = 64096;
131 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
132 terse.ObjectData[0] = this.CreateImprovedBlock();
133 foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) {
134 client.OutPacket(terse);
135 }
136 }
137 }
93 } 138 }
94 139
95 public void UpdateClient(OpenSimClient RemoteClient) 140 public void UpdateClient(OpenSimClient RemoteClient)
96 { 141 {
97 byte[] pb = this.position.GetBytes(); 142
143 LLVector3 lPos;
144 if( this._physActor != null && this.physicsEnabled)
145 {
146 PhysicsVector pPos = this._physActor.Position;
147 lPos = new LLVector3( pPos.X, pPos.Y, pPos.Z);
148 }
149 else
150 {
151 lPos = this.position;
152 }
153 byte[] pb = lPos.GetBytes();
98 Array.Copy(pb, 0, OurPacket.ObjectData[0].ObjectData, 0, pb.Length); 154 Array.Copy(pb, 0, OurPacket.ObjectData[0].ObjectData, 0, pb.Length);
155
156 // OurPacket should be update with the follwing in updateShape() rather than having to do it here
99 OurPacket.ObjectData[0].OwnerID = this.primData.OwnerID; 157 OurPacket.ObjectData[0].OwnerID = this.primData.OwnerID;
100 OurPacket.ObjectData[0].PCode = this.primData.PCode; 158 OurPacket.ObjectData[0].PCode = this.primData.PCode;
101 OurPacket.ObjectData[0].PathBegin = this.primData.PathBegin; 159 OurPacket.ObjectData[0].PathBegin = this.primData.PathBegin;
@@ -137,7 +195,6 @@ namespace OpenSim.world
137 this.primData.PathCurve = addPacket.PathCurve; 195 this.primData.PathCurve = addPacket.PathCurve;
138 this.primData.ProfileCurve = addPacket.ProfileCurve; 196 this.primData.ProfileCurve = addPacket.ProfileCurve;
139 this.primData.ProfileHollow = addPacket.ProfileHollow; 197 this.primData.ProfileHollow = addPacket.ProfileHollow;
140
141 this.primData.PathRadiusOffset = addPacket.PathRadiusOffset; 198 this.primData.PathRadiusOffset = addPacket.PathRadiusOffset;
142 this.primData.PathRevolutions = addPacket.PathRevolutions; 199 this.primData.PathRevolutions = addPacket.PathRevolutions;
143 this.primData.PathTaperX = addPacket.PathTaperX; 200 this.primData.PathTaperX = addPacket.PathTaperX;
@@ -145,7 +202,6 @@ namespace OpenSim.world
145 this.primData.PathTwist = addPacket.PathTwist; 202 this.primData.PathTwist = addPacket.PathTwist;
146 this.primData.PathTwistBegin =addPacket.PathTwistBegin; 203 this.primData.PathTwistBegin =addPacket.PathTwistBegin;
147 this.dirtyFlag = true; 204 this.dirtyFlag = true;
148
149 } 205 }
150 206
151 public void CreateFromPacket( ObjectAddPacket addPacket, LLUUID agentID, uint localID) 207 public void CreateFromPacket( ObjectAddPacket addPacket, LLUUID agentID, uint localID)
@@ -162,7 +218,6 @@ namespace OpenSim.world
162 objupdate.ObjectData[0].ExtraParams = new byte[1]; 218 objupdate.ObjectData[0].ExtraParams = new byte[1];
163 objupdate.ObjectData[0].MediaURL = new byte[0]; 219 objupdate.ObjectData[0].MediaURL = new byte[0];
164 objupdate.ObjectData[0].NameValue = new byte[0]; 220 objupdate.ObjectData[0].NameValue = new byte[0];
165 objupdate.ObjectData[0].PSBlock = new byte[0];
166 objupdate.ObjectData[0].Text = new byte[0]; 221 objupdate.ObjectData[0].Text = new byte[0];
167 objupdate.ObjectData[0].TextColor = new byte[4]; 222 objupdate.ObjectData[0].TextColor = new byte[4];
168 objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0,0,0); 223 objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0,0,0);
@@ -232,7 +287,6 @@ namespace OpenSim.world
232 objupdate.ObjectData[0].ExtraParams = new byte[1]; 287 objupdate.ObjectData[0].ExtraParams = new byte[1];
233 objupdate.ObjectData[0].MediaURL = new byte[0]; 288 objupdate.ObjectData[0].MediaURL = new byte[0];
234 objupdate.ObjectData[0].NameValue = new byte[0]; 289 objupdate.ObjectData[0].NameValue = new byte[0];
235 objupdate.ObjectData[0].PSBlock = new byte[0];
236 objupdate.ObjectData[0].Text = new byte[0]; 290 objupdate.ObjectData[0].Text = new byte[0];
237 objupdate.ObjectData[0].TextColor = new byte[4]; 291 objupdate.ObjectData[0].TextColor = new byte[4];
238 objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0,0,0); 292 objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0,0,0);
@@ -291,7 +345,6 @@ namespace OpenSim.world
291 uint ID = this.localid; 345 uint ID = this.localid;
292 byte[] bytes = new byte[60]; 346 byte[] bytes = new byte[60];
293 347
294
295 int i = 0; 348 int i = 0;
296 ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); 349 ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock();
297 dat.TextureEntry = this.OurPacket.ObjectData[0].TextureEntry; 350 dat.TextureEntry = this.OurPacket.ObjectData[0].TextureEntry;
@@ -302,8 +355,18 @@ namespace OpenSim.world
302 bytes[i++] = (byte)((ID >> 24) % 256); 355 bytes[i++] = (byte)((ID >> 24) % 256);
303 bytes[i++]= 0; 356 bytes[i++]= 0;
304 bytes[i++]= 0; 357 bytes[i++]= 0;
305 358
306 byte[] pb = this.position.GetBytes(); 359 LLVector3 lPos;
360 if( this._physActor != null && this.physicsEnabled)
361 {
362 PhysicsVector pPos = this._physActor.Position;
363 lPos = new LLVector3( pPos.X, pPos.Y, pPos.Z);
364 }
365 else
366 {
367 lPos = this.position;
368 }
369 byte[] pb = lPos.GetBytes();
307 Array.Copy(pb, 0, bytes, i, pb.Length); 370 Array.Copy(pb, 0, bytes, i, pb.Length);
308 i += 12; 371 i += 12;
309 ushort ac = 32767; 372 ushort ac = 32767;
diff --git a/src/world/World.cs b/src/world/World.cs
index fb78819..e1c84bc 100644
--- a/src/world/World.cs
+++ b/src/world/World.cs
@@ -176,9 +176,8 @@ namespace OpenSim.world
176 ServerConsole.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world"); 176 ServerConsole.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world");
177 ServerConsole.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake "); 177 ServerConsole.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake ");
178 NewAvatar.SendRegionHandshake(this); 178 NewAvatar.SendRegionHandshake(this);
179 179 PhysicsVector pVec = new PhysicsVector(NewAvatar.position.X, NewAvatar.position.Y, NewAvatar.position.Z);
180 NewAvatar.PhysActor = this.phyScene.AddAvatar(new PhysicsVector(NewAvatar.position.X, NewAvatar.position.Y, NewAvatar.position.Z)); 180 NewAvatar.PhysActor = this.phyScene.AddAvatar(pVec);
181 //this.Update(); // will work for now, but needs to be optimised so we don't update everything in the sim for each new user
182 this.Entities.Add(AgentClient.AgentID, NewAvatar); 181 this.Entities.Add(AgentClient.AgentID, NewAvatar);
183 } 182 }
184 183
@@ -187,6 +186,10 @@ namespace OpenSim.world
187 ServerConsole.MainConsole.Instance.WriteLine("World.cs: AddNewPrim() - Creating new prim"); 186 ServerConsole.MainConsole.Instance.WriteLine("World.cs: AddNewPrim() - Creating new prim");
188 Primitive prim = new Primitive(); 187 Primitive prim = new Primitive();
189 prim.CreateFromPacket(addPacket, AgentClient.AgentID, this._primCount); 188 prim.CreateFromPacket(addPacket, AgentClient.AgentID, this._primCount);
189 PhysicsVector pVec = new PhysicsVector(prim.position.X, prim.position.Y, prim.position.Z);
190 PhysicsVector pSize = new PhysicsVector( 0.25f, 0.25f, 0.25f);
191 //prim.PhysActor = this.phyScene.AddPrim(pVec, pSize );
192 //prim.PhysicsEnabled = true;
190 this.Entities.Add(prim.uuid, prim); 193 this.Entities.Add(prim.uuid, prim);
191 this._primCount++; 194 this._primCount++;
192 } 195 }