Implements llSetForce() and llGetForce(). These are experimental and the units may not match the Linden implementation.
parent
d58346e798
commit
f74a9bcdc7
|
@ -1374,6 +1374,14 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
public PhysicsVector GetForce()
|
||||
{
|
||||
if (PhysActor != null)
|
||||
return PhysActor.Force;
|
||||
else
|
||||
return new PhysicsVector();
|
||||
}
|
||||
|
||||
[SecurityPermission(SecurityAction.LinkDemand,
|
||||
Flags = SecurityPermissionFlag.SerializationFormatter)]
|
||||
public virtual void GetObjectData(
|
||||
|
@ -2296,6 +2304,14 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
public void SetForce(PhysicsVector force)
|
||||
{
|
||||
if (PhysActor != null)
|
||||
{
|
||||
PhysActor.Force = force;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetGroup(LLUUID groupID, IClientAPI client)
|
||||
{
|
||||
_groupID = groupID;
|
||||
|
|
|
@ -332,6 +332,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
|||
public override PhysicsVector Force
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override PhysicsVector CenterOfMass
|
||||
|
|
|
@ -943,6 +943,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
public override PhysicsVector Force
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override PhysicsVector CenterOfMass
|
||||
|
|
|
@ -173,7 +173,7 @@ namespace OpenSim.Region.Physics.Manager
|
|||
|
||||
public abstract PhysicsVector Position { get; set; }
|
||||
public abstract float Mass { get; }
|
||||
public abstract PhysicsVector Force { get; }
|
||||
public abstract PhysicsVector Force { get; set; }
|
||||
public abstract PhysicsVector GeometricCenter { get; }
|
||||
public abstract PhysicsVector CenterOfMass { get; }
|
||||
public abstract PhysicsVector Velocity { get; set; }
|
||||
|
@ -277,6 +277,7 @@ namespace OpenSim.Region.Physics.Manager
|
|||
public override PhysicsVector Force
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override PhysicsVector CenterOfMass
|
||||
|
|
|
@ -534,6 +534,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
public override PhysicsVector Force
|
||||
{
|
||||
get { return new PhysicsVector(_target_velocity.X, _target_velocity.Y, _target_velocity.Z); }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override PhysicsVector CenterOfMass
|
||||
|
|
|
@ -103,6 +103,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
private CollisionLocker ode;
|
||||
|
||||
private bool m_taintforce = false;
|
||||
private PhysicsVector m_force = new PhysicsVector(0.0f, 0.0f, 0.0f);
|
||||
private List<PhysicsVector> m_forcelist = new List<PhysicsVector>();
|
||||
|
||||
private IMesh _mesh;
|
||||
|
@ -749,7 +750,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
changeshape(timestep);
|
||||
//
|
||||
|
||||
if (m_taintforce)
|
||||
if (m_taintforce || m_force != new PhysicsVector(0.0f, 0.0f, 0.0f))
|
||||
changeAddForce(timestep);
|
||||
|
||||
if (m_taintdisable)
|
||||
|
@ -1751,7 +1752,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
//m_log.Info("[PHYSICS]: dequeing forcelist");
|
||||
if (IsPhysical)
|
||||
{
|
||||
PhysicsVector iforce = new PhysicsVector();
|
||||
//PhysicsVector iforce = new PhysicsVector();
|
||||
PhysicsVector iforce = m_force * 100.0f;
|
||||
for (int i = 0; i < m_forcelist.Count; i++)
|
||||
{
|
||||
iforce = iforce + (m_forcelist[i] * 100);
|
||||
|
@ -1856,7 +1858,9 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
|
||||
public override PhysicsVector Force
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
//get { return PhysicsVector.Zero; }
|
||||
get { return m_force; }
|
||||
set { m_force = value; }
|
||||
}
|
||||
|
||||
public override PhysicsVector CenterOfMass
|
||||
|
|
|
@ -156,6 +156,7 @@ namespace OpenSim.Region.Physics.POSPlugin
|
|||
public override PhysicsVector Force
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override PhysicsVector CenterOfMass
|
||||
|
|
|
@ -118,6 +118,7 @@ namespace OpenSim.Region.Physics.POSPlugin
|
|||
public override PhysicsVector Force
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override PhysicsVector CenterOfMass
|
||||
|
|
|
@ -340,6 +340,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
|||
public override PhysicsVector Force
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override PhysicsVector CenterOfMass
|
||||
|
@ -669,6 +670,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
|||
public override PhysicsVector Force
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override PhysicsVector CenterOfMass
|
||||
|
|
|
@ -42,6 +42,7 @@ using OpenSim.Region.Environment.Interfaces;
|
|||
using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney;
|
||||
using OpenSim.Region.Environment.Modules.World.Land;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
using OpenSim.Region.Physics.Manager;
|
||||
using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase;
|
||||
|
||||
//using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL;
|
||||
|
@ -1578,14 +1579,40 @@ namespace OpenSim.Region.ScriptEngine.Common
|
|||
public void llSetForce(LSL_Types.Vector3 force, int local)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
NotImplemented("llSetForce");
|
||||
//NotImplemented("llSetForce");
|
||||
|
||||
if (m_host.ParentGroup != null)
|
||||
{
|
||||
if (m_host.ParentGroup.RootPart != null)
|
||||
{
|
||||
if (local != 0)
|
||||
force *= llGetRot();
|
||||
|
||||
m_host.ParentGroup.RootPart.SetForce(new PhysicsVector((float)force.x, (float)force.y, (float)force.z));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public LSL_Types.Vector3 llGetForce()
|
||||
{
|
||||
LSL_Types.Vector3 force = new LSL_Types.Vector3(0.0, 0.0, 0.0);
|
||||
|
||||
m_host.AddScriptLPS(1);
|
||||
NotImplemented("llGetForce");
|
||||
return new LSL_Types.Vector3();
|
||||
//NotImplemented("llGetForce");
|
||||
//return new LSL_Types.Vector3();
|
||||
|
||||
if (m_host.ParentGroup != null)
|
||||
{
|
||||
if (m_host.ParentGroup.RootPart != null)
|
||||
{
|
||||
PhysicsVector tmpForce = m_host.ParentGroup.RootPart.GetForce();
|
||||
force.x = tmpForce.X;
|
||||
force.y = tmpForce.Y;
|
||||
force.z = tmpForce.Z;
|
||||
}
|
||||
}
|
||||
|
||||
return force;
|
||||
}
|
||||
|
||||
public LSL_Types.LSLInteger llTarget(LSL_Types.Vector3 position, double range)
|
||||
|
|
|
@ -43,6 +43,7 @@ using OpenSim.Region.Environment.Interfaces;
|
|||
using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney;
|
||||
using OpenSim.Region.Environment.Modules.World.Land;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
using OpenSim.Region.Physics.Manager;
|
||||
using OpenSim.Region.ScriptEngine.Shared;
|
||||
using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
|
||||
using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
|
||||
|
@ -1430,14 +1431,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
public void llSetForce(LSL_Types.Vector3 force, int local)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
NotImplemented("llSetForce");
|
||||
//NotImplemented("llSetForce");
|
||||
|
||||
if (m_host.ParentGroup != null)
|
||||
{
|
||||
if (m_host.ParentGroup.RootPart != null)
|
||||
{
|
||||
if (local != 0)
|
||||
force *= llGetRot();
|
||||
|
||||
m_host.ParentGroup.RootPart.SetForce(new PhysicsVector((float)force.x, (float)force.y, (float)force.z));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public LSL_Types.Vector3 llGetForce()
|
||||
{
|
||||
LSL_Types.Vector3 force = new LSL_Types.Vector3(0.0, 0.0, 0.0);
|
||||
|
||||
m_host.AddScriptLPS(1);
|
||||
NotImplemented("llGetForce");
|
||||
return new LSL_Types.Vector3();
|
||||
//NotImplemented("llGetForce");
|
||||
//return new LSL_Types.Vector3();
|
||||
|
||||
if (m_host.ParentGroup != null)
|
||||
{
|
||||
if (m_host.ParentGroup.RootPart != null)
|
||||
{
|
||||
PhysicsVector tmpForce = m_host.ParentGroup.RootPart.GetForce();
|
||||
force.x = tmpForce.X;
|
||||
force.y = tmpForce.Y;
|
||||
force.z = tmpForce.Z;
|
||||
}
|
||||
}
|
||||
|
||||
return force;
|
||||
}
|
||||
|
||||
public LSL_Types.LSLInteger llTarget(LSL_Types.Vector3 position, double range)
|
||||
|
|
Loading…
Reference in New Issue