some changes due to lookAt and RotLookAt
parent
193b3079e4
commit
a9e58d6175
|
@ -2535,46 +2535,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
RootPart.ScheduleTerseUpdate(); // send a stop information
|
||||
}
|
||||
}
|
||||
|
||||
public void rotLookAt(Quaternion target, float strength, float damping)
|
||||
{
|
||||
SceneObjectPart rootpart = m_rootPart;
|
||||
if (rootpart != null)
|
||||
{
|
||||
if (IsAttachment)
|
||||
{
|
||||
/*
|
||||
ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
|
||||
if (avatar != null)
|
||||
{
|
||||
Rotate the Av?
|
||||
} */
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rootpart.PhysActor != null)
|
||||
{ // APID must be implemented in your physics system for this to function.
|
||||
rootpart.PhysActor.APIDTarget = new Quaternion(target.X, target.Y, target.Z, target.W);
|
||||
rootpart.PhysActor.APIDStrength = strength;
|
||||
rootpart.PhysActor.APIDDamping = damping;
|
||||
rootpart.PhysActor.APIDActive = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void stopLookAt()
|
||||
{
|
||||
SceneObjectPart rootpart = m_rootPart;
|
||||
if (rootpart != null)
|
||||
{
|
||||
if (rootpart.PhysActor != null)
|
||||
{ // APID must be implemented in your physics system for this to function.
|
||||
rootpart.PhysActor.APIDActive = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Uses a PID to attempt to clamp the object on the Z axis at the given height over tau seconds.
|
||||
|
@ -2726,12 +2686,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
// while physics doesn't suports LookAt, we do it in RootPart
|
||||
if (!IsSelected)
|
||||
RootPart.UpdateLookAt();
|
||||
|
||||
SceneObjectPart[] parts = m_parts.GetArray();
|
||||
for (int i = 0; i < parts.Length; i++)
|
||||
{
|
||||
SceneObjectPart part = parts[i];
|
||||
if (!IsSelected)
|
||||
part.UpdateLookAt();
|
||||
part.SendScheduledUpdates();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -458,6 +458,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
Velocity = Vector3.Zero;
|
||||
AngularVelocity = Vector3.Zero;
|
||||
Acceleration = Vector3.Zero;
|
||||
APIDActive = false;
|
||||
Flags = 0;
|
||||
CreateSelected = true;
|
||||
|
||||
|
@ -1713,12 +1714,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
if (PhysActor != null)
|
||||
{
|
||||
Velocity = new Vector3(0, 0, 0);
|
||||
Acceleration = new Vector3(0, 0, 0);
|
||||
if (ParentGroup.RootPart == this)
|
||||
AngularVelocity = new Vector3(0, 0, 0);
|
||||
ParentGroup.Scene.RemovePhysicalPrim(1);
|
||||
RemoveFromPhysics();
|
||||
Stop();
|
||||
}
|
||||
}
|
||||
else if (PhysActor == null)
|
||||
|
@ -2350,9 +2348,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
ParentGroup.Scene.PhysicsScene.RequestJointDeletion(Name); // FIXME: what if the name changed?
|
||||
|
||||
// make sure client isn't interpolating the joint proxy object
|
||||
Velocity = Vector3.Zero;
|
||||
AngularVelocity = Vector3.Zero;
|
||||
Acceleration = Vector3.Zero;
|
||||
Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2391,8 +2387,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
Velocity = new Vector3(0, 0, 0);
|
||||
Acceleration = new Vector3(0, 0, 0);
|
||||
if (ParentGroup.RootPart == this)
|
||||
AngularVelocity = new Vector3(0, 0, 0);
|
||||
AngularVelocity = new Vector3(0, 0, 0);
|
||||
APIDActive = false;
|
||||
|
||||
if (pa.Phantom && !VolumeDetectActive)
|
||||
{
|
||||
|
@ -2994,7 +2990,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
//ParentGroup.RootPart.m_groupPosition = newpos;
|
||||
}
|
||||
/* ubit: there are no flexible links
|
||||
/*
|
||||
if (pa != null && ParentID != 0 && ParentGroup != null)
|
||||
{
|
||||
// Special case where a child object is requesting property updates.
|
||||
|
@ -3095,6 +3091,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public void RotLookAt(Quaternion target, float strength, float damping)
|
||||
{
|
||||
// non physical is done on LSL
|
||||
// physical is a rootpart thing
|
||||
if(ParentGroup.IsDeleted)
|
||||
return;
|
||||
|
||||
if(ParentGroup.RootPart != this)
|
||||
ParentGroup.RootPart.RotLookAt(target, strength, damping);
|
||||
|
||||
if (ParentGroup.IsAttachment)
|
||||
{
|
||||
/*
|
||||
|
@ -3125,16 +3129,31 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public void StartLookAt(Quaternion target, float strength, float damping)
|
||||
{
|
||||
// non physical is done on LSL
|
||||
// physical is a rootpart thing
|
||||
if(ParentGroup.IsDeleted)
|
||||
return;
|
||||
|
||||
if(ParentGroup.RootPart != this)
|
||||
ParentGroup.RootPart.RotLookAt(target, strength, damping);
|
||||
|
||||
RotLookAt(target,strength,damping);
|
||||
}
|
||||
|
||||
public void StopLookAt()
|
||||
{
|
||||
if(ParentGroup.IsDeleted)
|
||||
return;
|
||||
|
||||
if(ParentGroup.RootPart != this)
|
||||
ParentGroup.RootPart.StopLookAt();
|
||||
|
||||
if(APIDActive)
|
||||
AngularVelocity = Vector3.Zero;
|
||||
|
||||
APIDActive = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void ScheduleFullUpdateIfNone()
|
||||
{
|
||||
if (ParentGroup == null)
|
||||
|
@ -3543,7 +3562,6 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public int VehicleType
|
||||
{
|
||||
get
|
||||
|
@ -4733,10 +4751,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
|||
RemoveFromPhysics();
|
||||
}
|
||||
|
||||
Velocity = new Vector3(0, 0, 0);
|
||||
Acceleration = new Vector3(0, 0, 0);
|
||||
if (ParentGroup.RootPart == this)
|
||||
AngularVelocity = new Vector3(0, 0, 0);
|
||||
Stop();
|
||||
}
|
||||
|
||||
else
|
||||
|
@ -4909,17 +4924,15 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
|||
}
|
||||
}
|
||||
|
||||
if (applyDynamics)
|
||||
if (applyDynamics && LocalId != ParentGroup.RootPart.LocalId)
|
||||
// do independent of isphysical so parameters get setted (at least some)
|
||||
{
|
||||
Velocity = velocity;
|
||||
AngularVelocity = rotationalVelocity;
|
||||
// pa.Velocity = velocity;
|
||||
pa.RotationalVelocity = rotationalVelocity;
|
||||
|
||||
// if not vehicle and root part apply force and torque
|
||||
if ((m_vehicleParams == null || m_vehicleParams.Type == Vehicle.TYPE_NONE)
|
||||
&& LocalId == ParentGroup.RootPart.LocalId)
|
||||
if ((m_vehicleParams == null || m_vehicleParams.Type == Vehicle.TYPE_NONE))
|
||||
{
|
||||
pa.Force = Force;
|
||||
pa.Torque = Torque;
|
||||
|
@ -5629,5 +5642,13 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
|||
return m_sittingAvatars.Count;
|
||||
}
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
Velocity = Vector3.Zero;
|
||||
AngularVelocity = Vector3.Zero;
|
||||
Acceleration = Vector3.Zero;
|
||||
APIDActive = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue