Merged Gareth's Chat and Sticky edges code from trunk

physicsExample
MW 2007-03-04 19:35:53 +00:00
parent d9e3768ba9
commit ce70bd6b42
4 changed files with 62 additions and 27 deletions

View File

@ -155,6 +155,24 @@ namespace OpenSim
case PacketType.AgentUpdate: case PacketType.AgentUpdate:
ClientAvatar.HandleUpdate((AgentUpdatePacket)Pack); ClientAvatar.HandleUpdate((AgentUpdatePacket)Pack);
break; 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;
} }
} }

View File

@ -48,12 +48,12 @@ namespace PhysicsSystem
{ {
if(_plugins.ContainsKey(engineName)) if(_plugins.ContainsKey(engineName))
{ {
Console.WriteLine("returning "+engineName); Console.WriteLine("creating "+engineName);
return _plugins[engineName].GetScene(); return _plugins[engineName].GetScene();
} }
else else
{ {
Console.WriteLine("couldn't find "+ engineName); Console.WriteLine("couldn't find physicsEngine: "+ engineName);
return null; return null;
} }
} }

View File

@ -91,6 +91,26 @@ namespace PhysXplugin
actor.Position.X = actor.Position.X + actor.Velocity.X * timeStep; actor.Position.X = actor.Position.X + actor.Velocity.X * timeStep;
actor.Position.Y = actor.Position.Y + actor.Velocity.Y * timeStep; actor.Position.Y = actor.Position.Y + actor.Velocity.Y * timeStep;
actor.Position.Z = actor.Position.Z + actor.Velocity.Z * 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;
}
} }
} }

View File

@ -46,7 +46,6 @@ namespace OpenSim.world
this.updateflag = true; this.updateflag = true;
this.velocity = new LLVector3(force.X, force.Y, force.Z); //shouldn't really be doing this 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; Axiom.MathLib.Vector3 direc = q * v3;
direc.Normalize(); direc.Normalize();
Axiom.MathLib.Vector3 internDirec = new Vector3(direc.x, direc.y, direc.z);
//work out velocity for sim physics system //work out velocity for sim physics system
direc = direc * ((0.03f) * 128f); direc = direc * ((0.03f) * 128f);
newVelocity.X = direc.x; newVelocity.X = direc.x;
@ -263,7 +260,7 @@ namespace OpenSim.world
ushort InternVelocityX; ushort InternVelocityX;
ushort InternVelocityY; ushort InternVelocityY;
ushort InternVelocityZ; 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 = internDirec /128.0f;
internDirec.x += 1; internDirec.x += 1;
internDirec.y += 1; internDirec.y += 1;