Revert "BulletSim: Add logic to linksets to change physical properties for"

The changes don't seem to be ready for prime time.

This reverts commit b44f0e1a00.
TeleportWork
Robert Adams 2013-07-22 12:07:42 -07:00
parent b44f0e1a00
commit 84d0699761
3 changed files with 7 additions and 59 deletions

View File

@ -69,7 +69,7 @@ public class BSActorCollection
{ {
lock (m_actors) lock (m_actors)
{ {
ForEachActor(a => a.Dispose()); Release();
m_actors.Clear(); m_actors.Clear();
} }
} }
@ -98,6 +98,10 @@ public class BSActorCollection
{ {
ForEachActor(a => a.SetEnabled(enabl)); ForEachActor(a => a.SetEnabled(enabl));
} }
public void Release()
{
ForEachActor(a => a.Dispose());
}
public void Refresh() public void Refresh()
{ {
ForEachActor(a => a.Refresh()); ForEachActor(a => a.Refresh());

View File

@ -309,14 +309,14 @@ public abstract class BSLinkset
} }
); );
} }
public virtual void ComputeLocalInertia(OMV.Vector3 inertiaFactor) public virtual void ComputeLocalInertia()
{ {
ForEachMember((member) => ForEachMember((member) =>
{ {
if (member.PhysBody.HasPhysicalBody) if (member.PhysBody.HasPhysicalBody)
{ {
OMV.Vector3 inertia = m_physicsScene.PE.CalculateLocalInertia(member.PhysShape.physShapeInfo, member.Mass); OMV.Vector3 inertia = m_physicsScene.PE.CalculateLocalInertia(member.PhysShape.physShapeInfo, member.Mass);
member.Inertia = inertia * inertiaFactor; member.Inertia = inertia * BSParam.VehicleInertiaFactor;
m_physicsScene.PE.SetMassProps(member.PhysBody, member.Mass, member.Inertia); m_physicsScene.PE.SetMassProps(member.PhysBody, member.Mass, member.Inertia);
m_physicsScene.PE.UpdateInertiaTensor(member.PhysBody); m_physicsScene.PE.UpdateInertiaTensor(member.PhysBody);
} }
@ -324,26 +324,6 @@ public abstract class BSLinkset
} }
); );
} }
public virtual void SetPhysicalCollisionFlags(CollisionFlags collFlags)
{
ForEachMember((member) =>
{
if (member.PhysBody.HasPhysicalBody)
m_physicsScene.PE.SetCollisionFlags(member.PhysBody, collFlags);
return false; // 'false' says to continue looping
}
);
}
public virtual void RemoveFromPhysicalCollisionFlags(CollisionFlags collFlags)
{
ForEachMember((member) =>
{
if (member.PhysBody.HasPhysicalBody)
m_physicsScene.PE.RemoveFromCollisionFlags(member.PhysBody, collFlags);
return false; // 'false' says to continue looping
}
);
}
// ================================================================ // ================================================================
protected virtual float ComputeLinksetMass() protected virtual float ComputeLinksetMass()
{ {

View File

@ -44,42 +44,6 @@ public sealed class BSLinksetCompound : BSLinkset
{ {
} }
// ================================================================
// Changing the physical property of the linkset only needs to change the root
public override void SetPhysicalFriction(float friction)
{
if (LinksetRoot.PhysBody.HasPhysicalBody)
m_physicsScene.PE.SetFriction(LinksetRoot.PhysBody, friction);
}
public override void SetPhysicalRestitution(float restitution)
{
if (LinksetRoot.PhysBody.HasPhysicalBody)
m_physicsScene.PE.SetRestitution(LinksetRoot.PhysBody, restitution);
}
public override void SetPhysicalGravity(OMV.Vector3 gravity)
{
if (LinksetRoot.PhysBody.HasPhysicalBody)
m_physicsScene.PE.SetGravity(LinksetRoot.PhysBody, gravity);
}
public override void ComputeLocalInertia(OMV.Vector3 inertiaFactor)
{
OMV.Vector3 inertia = m_physicsScene.PE.CalculateLocalInertia(LinksetRoot.PhysShape.physShapeInfo, LinksetRoot.Mass);
LinksetRoot.Inertia = inertia * inertiaFactor;
m_physicsScene.PE.SetMassProps(LinksetRoot.PhysBody, LinksetRoot.Mass, LinksetRoot.Inertia);
m_physicsScene.PE.UpdateInertiaTensor(LinksetRoot.PhysBody);
}
public override void SetPhysicalCollisionFlags(CollisionFlags collFlags)
{
if (LinksetRoot.PhysBody.HasPhysicalBody)
m_physicsScene.PE.SetCollisionFlags(LinksetRoot.PhysBody, collFlags);
}
public override void RemoveFromPhysicalCollisionFlags(CollisionFlags collFlags)
{
if (LinksetRoot.PhysBody.HasPhysicalBody)
m_physicsScene.PE.RemoveFromCollisionFlags(LinksetRoot.PhysBody, collFlags);
}
// ================================================================
// When physical properties are changed the linkset needs to recalculate // When physical properties are changed the linkset needs to recalculate
// its internal properties. // its internal properties.
public override void Refresh(BSPrimLinkable requestor) public override void Refresh(BSPrimLinkable requestor)