some changes due to lookAt and RotLookAt
parent
193b3079e4
commit
a9e58d6175
|
@ -2536,46 +2536,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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>
|
/// <summary>
|
||||||
/// Uses a PID to attempt to clamp the object on the Z axis at the given height over tau seconds.
|
/// Uses a PID to attempt to clamp the object on the Z axis at the given height over tau seconds.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -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();
|
SceneObjectPart[] parts = m_parts.GetArray();
|
||||||
for (int i = 0; i < parts.Length; i++)
|
for (int i = 0; i < parts.Length; i++)
|
||||||
{
|
{
|
||||||
SceneObjectPart part = parts[i];
|
SceneObjectPart part = parts[i];
|
||||||
if (!IsSelected)
|
|
||||||
part.UpdateLookAt();
|
|
||||||
part.SendScheduledUpdates();
|
part.SendScheduledUpdates();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -458,6 +458,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Velocity = Vector3.Zero;
|
Velocity = Vector3.Zero;
|
||||||
AngularVelocity = Vector3.Zero;
|
AngularVelocity = Vector3.Zero;
|
||||||
Acceleration = Vector3.Zero;
|
Acceleration = Vector3.Zero;
|
||||||
|
APIDActive = false;
|
||||||
Flags = 0;
|
Flags = 0;
|
||||||
CreateSelected = true;
|
CreateSelected = true;
|
||||||
|
|
||||||
|
@ -1713,12 +1714,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (PhysActor != null)
|
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);
|
ParentGroup.Scene.RemovePhysicalPrim(1);
|
||||||
RemoveFromPhysics();
|
RemoveFromPhysics();
|
||||||
|
Stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (PhysActor == null)
|
else if (PhysActor == null)
|
||||||
|
@ -2350,9 +2348,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
ParentGroup.Scene.PhysicsScene.RequestJointDeletion(Name); // FIXME: what if the name changed?
|
ParentGroup.Scene.PhysicsScene.RequestJointDeletion(Name); // FIXME: what if the name changed?
|
||||||
|
|
||||||
// make sure client isn't interpolating the joint proxy object
|
// make sure client isn't interpolating the joint proxy object
|
||||||
Velocity = Vector3.Zero;
|
Stop();
|
||||||
AngularVelocity = Vector3.Zero;
|
|
||||||
Acceleration = Vector3.Zero;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2391,8 +2387,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
Velocity = new Vector3(0, 0, 0);
|
Velocity = new Vector3(0, 0, 0);
|
||||||
Acceleration = 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)
|
if (pa.Phantom && !VolumeDetectActive)
|
||||||
{
|
{
|
||||||
|
@ -2994,7 +2990,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
//ParentGroup.RootPart.m_groupPosition = newpos;
|
//ParentGroup.RootPart.m_groupPosition = newpos;
|
||||||
}
|
}
|
||||||
/* ubit: there are no flexible links
|
/*
|
||||||
if (pa != null && ParentID != 0 && ParentGroup != null)
|
if (pa != null && ParentID != 0 && ParentGroup != null)
|
||||||
{
|
{
|
||||||
// Special case where a child object is requesting property updates.
|
// 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)
|
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)
|
if (ParentGroup.IsAttachment)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -3125,16 +3129,31 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void StartLookAt(Quaternion target, float strength, float damping)
|
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);
|
RotLookAt(target,strength,damping);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StopLookAt()
|
public void StopLookAt()
|
||||||
{
|
{
|
||||||
|
if(ParentGroup.IsDeleted)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(ParentGroup.RootPart != this)
|
||||||
|
ParentGroup.RootPart.StopLookAt();
|
||||||
|
|
||||||
|
if(APIDActive)
|
||||||
|
AngularVelocity = Vector3.Zero;
|
||||||
|
|
||||||
APIDActive = false;
|
APIDActive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void ScheduleFullUpdateIfNone()
|
public void ScheduleFullUpdateIfNone()
|
||||||
{
|
{
|
||||||
if (ParentGroup == null)
|
if (ParentGroup == null)
|
||||||
|
@ -3543,7 +3562,6 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public int VehicleType
|
public int VehicleType
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -4733,10 +4751,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
RemoveFromPhysics();
|
RemoveFromPhysics();
|
||||||
}
|
}
|
||||||
|
|
||||||
Velocity = new Vector3(0, 0, 0);
|
Stop();
|
||||||
Acceleration = new Vector3(0, 0, 0);
|
|
||||||
if (ParentGroup.RootPart == this)
|
|
||||||
AngularVelocity = new Vector3(0, 0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
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)
|
// do independent of isphysical so parameters get setted (at least some)
|
||||||
{
|
{
|
||||||
Velocity = velocity;
|
Velocity = velocity;
|
||||||
AngularVelocity = rotationalVelocity;
|
AngularVelocity = rotationalVelocity;
|
||||||
// pa.Velocity = velocity;
|
|
||||||
pa.RotationalVelocity = rotationalVelocity;
|
pa.RotationalVelocity = rotationalVelocity;
|
||||||
|
|
||||||
// if not vehicle and root part apply force and torque
|
// if not vehicle and root part apply force and torque
|
||||||
if ((m_vehicleParams == null || m_vehicleParams.Type == Vehicle.TYPE_NONE)
|
if ((m_vehicleParams == null || m_vehicleParams.Type == Vehicle.TYPE_NONE))
|
||||||
&& LocalId == ParentGroup.RootPart.LocalId)
|
|
||||||
{
|
{
|
||||||
pa.Force = Force;
|
pa.Force = Force;
|
||||||
pa.Torque = Torque;
|
pa.Torque = Torque;
|
||||||
|
@ -5629,5 +5642,13 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
return m_sittingAvatars.Count;
|
return m_sittingAvatars.Count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Stop()
|
||||||
|
{
|
||||||
|
Velocity = Vector3.Zero;
|
||||||
|
AngularVelocity = Vector3.Zero;
|
||||||
|
Acceleration = Vector3.Zero;
|
||||||
|
APIDActive = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue