r105 somehow got put in wrong place, so replacing files

brokenplugins
MW 2007-03-02 18:24:54 +00:00
parent 40a52b0f55
commit acc98fca7b
3 changed files with 138 additions and 253 deletions

View File

@ -4,7 +4,6 @@ using System.IO;
using System.Text;
using libsecondlife;
using libsecondlife.Packets;
using PhysicsManager;
namespace OpenSim.world
{
@ -13,11 +12,7 @@ namespace OpenSim.world
public string firstname;
public string lastname;
public OpenSimClient ControllingClient;
private PhysicsActor _physActor;
private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate;
private bool updateflag;
private bool walking;
private List<NewForce> forcesList = new List<NewForce>();
public Avatar(OpenSimClient TheClient) {
Console.WriteLine("Avatar.cs - Loading details from grid (DUMMY)");
@ -25,39 +20,6 @@ namespace OpenSim.world
SetupTemplate("avatar-template.dat");
}
public PhysicsActor PhysActor
{
set
{
this._physActor = value;
}
}
public override void addFroces()
{
if(this.forcesList.Count>0)
{
for(int i=0 ; i < this.forcesList.Count; i++)
{
NewForce force = this.forcesList[i];
PhysicsVector phyVector = new PhysicsVector(force.X, force.Y, force.Z);
this.PhysActor.Velocity = phyVector;
this.updateflag = true;
this.velocity = new Axiom.MathLib.Vector3(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.
}
}
}
public override void update()
{
if(this.updateflag)
{
//need to send movement info
//so create the improvedterseobjectupdate packet
}
}
private void SetupTemplate(string name)
{
@ -151,39 +113,6 @@ namespace OpenSim.world
ControllingClient.OutPacket(aw);
}
public void HandleUpdate(AgentUpdatePacket pack) {
if(((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_POS) !=0) {
if(!walking)
{
//we should add a new force to the list
// but for now we will deal with velocities
NewFoce newVelocity = new NewForce();
Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(1, 0, 0);
Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(pack.AgentData.BodyRotation.W, pack.AgentData.BodyRotation.X, pack.AgentData.BodyRotation.Y, pack.AgentData.BodyRotation.Z);
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;
newVelocity.Y = direc.y;
newVelocity.Z = direc.z;
this.forcesList.Add(newVelocity);
walking=true;
}
}
else
{
if(walking)
{
}
}
}
//should be moved somewhere else
public void SendRegionHandshake(World RegionInfo) {
Console.WriteLine("Avatar.cs:SendRegionHandshake() - Creating empty RegionHandshake packet");
System.Text.Encoding _enc = System.Text.Encoding.ASCII;
@ -219,16 +148,4 @@ namespace OpenSim.world
this.ControllingClient.OutPacket(handshake);
}
}
public class NewForce
{
public float X;
public float Y;
public float Z;
public NewForce()
{
}
}
}

View File

@ -9,9 +9,9 @@ namespace OpenSim.world
public class Entity
{
protected libsecondlife.LLUUID uuid;
public Vector3 position;
public Vector3 velocity;
public Quaternion rotation;
protected Vector3 position;
protected Vector3 velocity;
protected Quaternion rotation;
protected string name;
protected List<Entity> children;
@ -24,13 +24,7 @@ namespace OpenSim.world
name = "(basic entity)";
children = new List<Entity>();
}
public virtual void addFroces()
{
foreach (Entity child in children)
{
child.addFroces();
}
}
public virtual void update() {
// Do any per-frame updates needed that are applicable to every type of entity
foreach (Entity child in children)

View File

@ -3,7 +3,6 @@ using libsecondlife;
using libsecondlife.Packets;
using System.Collections.Generic;
using System.Text;
using PhysicsManager;
namespace OpenSim.world
{
@ -14,8 +13,6 @@ namespace OpenSim.world
public ScriptEngine Scripts;
public TerrainDecode terrainengine = new TerrainDecode();
public uint _localNumber=0;
private PhysicsScene phyScene;
private float timeStep= 0.1f;
private Random Rand = new Random();
@ -36,29 +33,8 @@ namespace OpenSim.world
Scripts = new ScriptEngine(this);
}
public PhysicsScene PhysScene
{
set
{
this.phyScene = value;
}
}
public void Update()
{
if(this.phyScene.IsThreaded)
{
this.phyScene.GetResults();
}
foreach (libsecondlife.LLUUID UUID in Entities.Keys)
{
Entities[UUID].addFroces();
}
this.phyScene.Simulate(timeStep);
foreach (libsecondlife.LLUUID UUID in Entities.Keys)
{
Entities[UUID].update();
@ -79,9 +55,7 @@ namespace OpenSim.world
this.Entities.Add(AgentClient.AgentID, NewAvatar);
Console.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake ");
NewAvatar.SendRegionHandshake(this);
NewAvatar.PhysActor = this.phyScene.AddAvatar(new PhysicsVector(NewAvatar.position.x, NewAvatar.position.y, NewAvatar.position.z));
//this.Update(); // will work for now, but needs to be optimised so we don't update everything in the sim for each new user
this.Update(); // will work for now, but needs to be optimised so we don't update everything in the sim for each new user
}
public bool Backup() {