diff --git a/OpenSimClient.cs b/OpenSimClient.cs index c7c9587a74..276f09c0d0 100644 --- a/OpenSimClient.cs +++ b/OpenSimClient.cs @@ -134,27 +134,45 @@ namespace OpenSim public void ProcessInPacket(Packet Pack) { ack_pack(Pack); switch(Pack.Type) { - case PacketType.CompleteAgentMovement: - ClientAvatar.CompleteMovement(OpenSim_Main.local_world); - ClientAvatar.SendInitialPosition(); - break; - case PacketType.RegionHandshakeReply: - OpenSim_Main.local_world.SendLayerData(this); - break; - case PacketType.AgentWearablesRequest: - ClientAvatar.SendInitialAppearance(); - break; - case PacketType.TransferRequest: - Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request"); - // We put transfer requests into a big queue and then spawn a thread for each new one - TransferRequestPacket transfer = (TransferRequestPacket)Pack; + case PacketType.CompleteAgentMovement: + ClientAvatar.CompleteMovement(OpenSim_Main.local_world); + ClientAvatar.SendInitialPosition(); + break; + case PacketType.RegionHandshakeReply: + OpenSim_Main.local_world.SendLayerData(this); + break; + case PacketType.AgentWearablesRequest: + ClientAvatar.SendInitialAppearance(); + break; + case PacketType.TransferRequest: + Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request"); + // We put transfer requests into a big queue and then spawn a thread for each new one + TransferRequestPacket transfer = (TransferRequestPacket)Pack; AssetRequests.Enqueue(transfer); - Thread AssetLoaderThread = new Thread(new ThreadStart(AssetLoader)); - AssetLoaderThread.Start(); - break; - case PacketType.AgentUpdate: - ClientAvatar.HandleUpdate((AgentUpdatePacket)Pack); - break; + Thread AssetLoaderThread = new Thread(new ThreadStart(AssetLoader)); + AssetLoaderThread.Start(); + break; + case PacketType.AgentUpdate: + ClientAvatar.HandleUpdate((AgentUpdatePacket)Pack); + break; + case PacketType.ChatFromViewer: + ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack; + if(Helpers.FieldToString(inchatpack.ChatData.Message)=="") break; + + System.Text.Encoding _enc = System.Text.Encoding.ASCII; + libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket(); + reply.ChatData.Audible = 1; + reply.ChatData.Message = inchatpack.ChatData.Message; + reply.ChatData.ChatType = 1; + reply.ChatData.SourceType = 1; + reply.ChatData.Position = this.ClientAvatar.position; + reply.ChatData.FromName = _enc.GetBytes(this.ClientAvatar.firstname + " " + this.ClientAvatar.lastname + "\0"); + reply.ChatData.OwnerID = this.AgentID; + reply.ChatData.SourceID = this.AgentID; + foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { + client.OutPacket(reply); + } + break; } } diff --git a/physics/PhysicsManager.cs b/physics/PhysicsManager.cs index 15ab5fec39..c336150c00 100644 --- a/physics/PhysicsManager.cs +++ b/physics/PhysicsManager.cs @@ -48,12 +48,12 @@ namespace PhysicsSystem { if(_plugins.ContainsKey(engineName)) { - Console.WriteLine("returning "+engineName); + Console.WriteLine("creating "+engineName); return _plugins[engineName].GetScene(); } else { - Console.WriteLine("couldn't find "+ engineName); + Console.WriteLine("couldn't find physicsEngine: "+ engineName); return null; } } diff --git a/physics/plugins/PhysXplugin.cs b/physics/plugins/PhysXplugin.cs index 17088647ea..baaca5b567 100644 --- a/physics/plugins/PhysXplugin.cs +++ b/physics/plugins/PhysXplugin.cs @@ -91,6 +91,26 @@ namespace PhysXplugin actor.Position.X = actor.Position.X + actor.Velocity.X * timeStep; actor.Position.Y = actor.Position.Y + actor.Velocity.Y * timeStep; actor.Position.Z = actor.Position.Z + actor.Velocity.Z * timeStep; + if(actor.Position.X<0) + { + actor.Position.X = 0; + actor.Velocity.X = 0; + } + if(actor.Position.Y < 0) + { + actor.Position.Y = 0; + actor.Velocity.Y = 0; + } + if(actor.Position.X > 255) + { + actor.Position.X = 255; + actor.Velocity.X = 0; + } + if(actor.Position.Y > 255) + { + actor.Position.Y = 255; + actor.Velocity.X = 0; + } } } diff --git a/world/Avatar.cs b/world/Avatar.cs index ee18f2e03c..19a8a9f320 100644 --- a/world/Avatar.cs +++ b/world/Avatar.cs @@ -45,8 +45,7 @@ namespace OpenSim.world this._physActor.Velocity = phyVector; this.updateflag = true; this.velocity = new LLVector3(force.X, force.Y, force.Z); //shouldn't really be doing this - // but as we are setting the velocity (rather than using real forces) at the moment it is okay. - + // but as we are setting the velocity (rather than using real forces) at the moment it is okay. } } } @@ -176,8 +175,6 @@ namespace OpenSim.world Axiom.MathLib.Vector3 direc = q * v3; direc.Normalize(); - Axiom.MathLib.Vector3 internDirec = new Vector3(direc.x, direc.y, direc.z); - //work out velocity for sim physics system direc = direc * ((0.03f) * 128f); newVelocity.X = direc.x; @@ -263,7 +260,7 @@ namespace OpenSim.world ushort InternVelocityX; ushort InternVelocityY; ushort InternVelocityZ; - Axiom.MathLib.Vector3 internDirec = new Axiom.MathLib.Vector3(this.velocity.X, this.velocity.Y, this.velocity.Z); + Axiom.MathLib.Vector3 internDirec = new Axiom.MathLib.Vector3(this._physActor.Velocity.X, this._physActor.Velocity.Y, this._physActor.Velocity.Z); internDirec = internDirec /128.0f; internDirec.x += 1; internDirec.y += 1;