Implemented Resize Method in OdePrim.

attached the links to that from SceneObject, so now resizing works (as much as resizing currently works in opensim, fixing resizing in general is on my todo list for today).
Rotation of a root prim also now updates the physics engine.
So think there really is only deleteprim left, then it should be usable (Different shapes (other than boxes that it currently uses) can wait a little bit longer).
[of course there are still the other issues of ODE not really working when there is more than one region in a instance of opensim].
afrisby
MW 2007-08-23 11:38:50 +00:00
parent 8264ba849f
commit edd50f2e8e
3 changed files with 31 additions and 8 deletions

View File

@ -547,7 +547,7 @@ namespace OpenSim.Region.Environment.Scenes
SceneObjectGroup sceneOb = new SceneObjectGroup(this, this.m_regionHandle, ownerID, PrimIDAllocate(), pos, shape); SceneObjectGroup sceneOb = new SceneObjectGroup(this, this.m_regionHandle, ownerID, PrimIDAllocate(), pos, shape);
AddEntity(sceneOb); AddEntity(sceneOb);
SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID); SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID);
// rootPart.PhysActor =phyScene.AddPrim(new PhysicsVector(pos.X, pos.Y, pos.Z), new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z), //rootPart.PhysActor =phyScene.AddPrim(new PhysicsVector(pos.X, pos.Y, pos.Z), new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z),
// new Axiom.Math.Quaternion()); // new Axiom.Math.Quaternion());
} }

View File

@ -717,6 +717,13 @@ namespace OpenSim.Region.Environment.Scenes
if (part != null) if (part != null)
{ {
part.Resize(scale); part.Resize(scale);
if (part.UUID == this.m_rootPart.UUID)
{
if (m_rootPart.PhysActor != null)
{
m_rootPart.PhysActor.Size = new PhysicsVector(m_rootPart.Scale.X, m_rootPart.Scale.Y, m_rootPart.Scale.Z);
}
}
} }
} }
#endregion #endregion
@ -789,6 +796,10 @@ namespace OpenSim.Region.Environment.Scenes
public void UpdateGroupRotation(LLQuaternion rot) public void UpdateGroupRotation(LLQuaternion rot)
{ {
this.m_rootPart.UpdateRotation(rot); this.m_rootPart.UpdateRotation(rot);
if (m_rootPart.PhysActor != null)
{
m_rootPart.PhysActor.Orientation = new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z);
}
this.ScheduleGroupForTerseUpdate(); this.ScheduleGroupForTerseUpdate();
} }
@ -800,6 +811,10 @@ namespace OpenSim.Region.Environment.Scenes
public void UpdateGroupRotation(LLVector3 pos, LLQuaternion rot) public void UpdateGroupRotation(LLVector3 pos, LLQuaternion rot)
{ {
this.m_rootPart.UpdateRotation(rot); this.m_rootPart.UpdateRotation(rot);
if (m_rootPart.PhysActor != null)
{
m_rootPart.PhysActor.Orientation = new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z);
}
this.AbsolutePosition = pos; this.AbsolutePosition = pos;
this.ScheduleGroupForTerseUpdate(); this.ScheduleGroupForTerseUpdate();
} }
@ -832,6 +847,10 @@ namespace OpenSim.Region.Environment.Scenes
private void UpdateRootRotation(LLQuaternion rot) private void UpdateRootRotation(LLQuaternion rot)
{ {
this.m_rootPart.UpdateRotation(rot); this.m_rootPart.UpdateRotation(rot);
if (m_rootPart.PhysActor != null)
{
m_rootPart.PhysActor.Orientation = new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z);
}
Axiom.Math.Quaternion axRot = new Quaternion(rot.W, rot.X, rot.Y, rot.Z); Axiom.Math.Quaternion axRot = new Quaternion(rot.W, rot.X, rot.Y, rot.Z);
Axiom.Math.Quaternion oldParentRot = new Quaternion(this.m_rootPart.RotationOffset.W, this.m_rootPart.RotationOffset.X, this.m_rootPart.RotationOffset.Y, this.m_rootPart.RotationOffset.Z); Axiom.Math.Quaternion oldParentRot = new Quaternion(this.m_rootPart.RotationOffset.W, this.m_rootPart.RotationOffset.X, this.m_rootPart.RotationOffset.Y, this.m_rootPart.RotationOffset.Z);

View File

@ -148,7 +148,7 @@ namespace OpenSim.Region.Physics.OdePlugin
public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation) public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation)
{ {
Console.WriteLine("+++++++++++++++++++++++++++++++++AddPrim pos: " + position + " size: " + size + " quat: " + rotation); //Console.WriteLine("+++++++++++++++++++++++++++++++++AddPrim pos: " + position + " size: " + size + " quat: " + rotation);
PhysicsVector pos = new PhysicsVector(); PhysicsVector pos = new PhysicsVector();
pos.X = position.X; pos.X = position.X;
pos.Y = position.Y; pos.Y = position.Y;
@ -437,7 +437,7 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
set set
{ {
Console.WriteLine("+++++++++++++++++++++++++++++++++++++++++++ setting pos: " + value); //Console.WriteLine("+++++++++++++++++++++++++++++++++++++++++++ setting pos: " + value);
_position = value; _position = value;
Monitor.Enter(typeof(OdeScene)); Monitor.Enter(typeof(OdeScene));
d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
@ -454,8 +454,11 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
set set
{ {
Console.WriteLine("+++++++++++++++++++++++++++++++++++++++++++ setting size: " + value); //Console.WriteLine("+++++++++++++++++++++++++++++++++++++++++++ setting size: " + value);
_size = value; _size = value;
Monitor.Enter(typeof(OdeScene));
d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z);
Monitor.Exit(typeof(OdeScene));
} }
} }
@ -490,6 +493,7 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
set set
{ {
//Console.WriteLine("+++++++++++++++++++++++++++++++++++++++++++ setting Orientation");
_orientation = value; _orientation = value;
Monitor.Enter(typeof(OdeScene)); Monitor.Enter(typeof(OdeScene));
d.Quaternion myrot = new d.Quaternion(); d.Quaternion myrot = new d.Quaternion();