本文整理汇总了C#中OpenSim.Region.Physics.BulletSPlugin.BSPhysObject类的典型用法代码示例。如果您正苦于以下问题:C# BSPhysObject类的具体用法?C# BSPhysObject怎么用?C# BSPhysObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BSPhysObject类属于OpenSim.Region.Physics.BulletSPlugin命名空间,在下文中一共展示了BSPhysObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BSActorAvatarMove
public BSActorAvatarMove(BSScene physicsScene, BSPhysObject pObj, string actorName)
: base(physicsScene, pObj, actorName)
{
m_velocityMotor = null;
m_walkingUpStairs = 0;
m_physicsScene.DetailLog("{0},BSActorAvatarMove,constructor", m_controllingPrim.LocalID);
}
示例2: BSActor
public BSActor(BSScene physicsScene, BSPhysObject pObj, string actorName)
{
m_physicsScene = physicsScene;
m_controllingPrim = pObj;
ActorName = actorName;
Enabled = true;
}
示例3: GetShapeReference
// Get a reference to a physical shape. Create if it doesn't exist
public static BSShape GetShapeReference(BSScene physicsScene, bool forceRebuild, BSPhysObject prim)
{
BSShape ret = null;
if (prim.PreferredPhysicalShape == BSPhysicsShapeType.SHAPE_CAPSULE)
{
// an avatar capsule is close to a native shape (it is not shared)
ret = BSShapeNative.GetReference(physicsScene, prim, BSPhysicsShapeType.SHAPE_CAPSULE,
FixedShapeKey.KEY_CAPSULE);
physicsScene.DetailLog("{0},BSShape.GetShapeReference,avatarCapsule,shape={1}", prim.LocalID, ret);
}
// Compound shapes are handled special as they are rebuilt from scratch.
// This isn't too great a hardship since most of the child shapes will have already been created.
if (ret == null && prim.PreferredPhysicalShape == BSPhysicsShapeType.SHAPE_COMPOUND)
{
// Getting a reference to a compound shape gets you the compound shape with the root prim shape added
ret = BSShapeCompound.GetReference(prim);
physicsScene.DetailLog("{0},BSShapeCollection.CreateGeom,compoundShape,shape={1}", prim.LocalID, ret);
}
// Avatars have their own unique shape
if (ret == null && prim.PreferredPhysicalShape == BSPhysicsShapeType.SHAPE_AVATAR)
{
// Getting a reference to a compound shape gets you the compound shape with the root prim shape added
ret = BSShapeAvatar.GetReference(prim);
physicsScene.DetailLog("{0},BSShapeCollection.CreateGeom,avatarShape,shape={1}", prim.LocalID, ret);
}
if (ret == null)
ret = GetShapeReferenceNonSpecial(physicsScene, forceRebuild, prim);
return ret;
}
示例4: GetBodyAndShape
// Called to update/change the body and shape for an object.
// The object has some shape and body on it. Here we decide if that is the correct shape
// for the current state of the object (static/dynamic/...).
// If bodyCallback is not null, it is called if either the body or the shape are changed
// so dependencies (like constraints) can be removed before the physical object is dereferenced.
// Return 'true' if either the body or the shape changed.
// Called at taint-time.
public bool GetBodyAndShape(bool forceRebuild, BulletWorld sim, BSPhysObject prim, PhysicalDestructionCallback bodyCallback)
{
m_physicsScene.AssertInTaintTime("BSShapeCollection.GetBodyAndShape");
bool ret = false;
// This lock could probably be pushed down lower but building shouldn't take long
lock (m_collectionActivityLock)
{
// Do we have the correct geometry for this type of object?
// Updates prim.BSShape with information/pointers to shape.
// Returns 'true' of BSShape is changed to a new shape.
bool newGeom = CreateGeom(forceRebuild, prim, bodyCallback);
// If we had to select a new shape geometry for the object,
// rebuild the body around it.
// Updates prim.BSBody with information/pointers to requested body
// Returns 'true' if BSBody was changed.
bool newBody = CreateBody((newGeom || forceRebuild), prim, m_physicsScene.World, bodyCallback);
ret = newGeom || newBody;
}
DetailLog("{0},BSShapeCollection.GetBodyAndShape,taintExit,force={1},ret={2},body={3},shape={4}",
prim.LocalID, forceRebuild, ret, prim.PhysBody, prim.PhysShape);
return ret;
}
示例5: BSActorLockAxis
public BSActorLockAxis(BSScene physicsScene, BSPhysObject pObj, string actorName)
: base(physicsScene, pObj, actorName)
{
m_physicsScene.DetailLog("{0},BSActorLockAxis,constructor", m_controllingPrim.LocalID);
LockAxisConstraint = null;
HaveRegisteredForBeforeStepCallback = false;
}
示例6: BSActorLockAxis
public BSActorLockAxis(BSScene physicsScene, BSPhysObject pObj, string actorName)
: base(physicsScene, pObj, actorName)
{
m_physicsScene.DetailLog("{0},BSActorLockAxis,constructor", m_controllingPrim.LocalID);
LockAxisConstraint = null;
// we place our constraint just before the simulation step to make sure the linkset is complete
m_physicsScene.BeforeStep += PhysicsScene_BeforeStep;
}
示例7: PreferredPhysicalShape
// For compound implimented linksets, if there are children, use compound shape for the root.
public override BSPhysicsShapeType PreferredPhysicalShape(BSPhysObject requestor)
{
// Returning 'unknown' means we don't have a preference.
BSPhysicsShapeType ret = BSPhysicsShapeType.SHAPE_UNKNOWN;
if (IsRoot(requestor) && HasAnyChildren)
{
ret = BSPhysicsShapeType.SHAPE_COMPOUND;
}
// DetailLog("{0},BSLinksetCompound.PreferredPhysicalShape,call,shape={1}", LinksetRoot.LocalID, ret);
return ret;
}
示例8: BSLinkset
public BSLinkset(BSScene scene, BSPhysObject parent)
{
// A simple linkset of one (no children)
LinksetID = m_nextLinksetID++;
// We create LOTS of linksets.
if (m_nextLinksetID <= 0)
m_nextLinksetID = 1;
PhysicsScene = scene;
LinksetRoot = parent;
m_children = new List<BSPhysObject>();
m_taintChildren = new List<BSPhysObject>();
m_mass = parent.MassRaw;
}
示例9: Refresh
// When physical properties are changed the linkset needs to recalculate
// its internal properties.
// This is queued in the 'post taint' queue so the
// refresh will happen once after all the other taints are applied.
public override void Refresh(BSPhysObject requestor)
{
base.Refresh(requestor);
if (HasAnyChildren && IsRoot(requestor))
{
// Queue to happen after all the other taint processing
PhysicsScene.PostTaintObject("BSLinksetContraints.Refresh", requestor.LocalID, delegate()
{
if (HasAnyChildren && IsRoot(requestor))
RecomputeLinksetConstraints();
});
}
}
示例10: Factory
// private static string LogHeader = "[BULLETSIM LINKSET]";
// Create the correct type of linkset for this child
public static BSLinkset Factory(BSScene physScene, BSPhysObject parent)
{
BSLinkset ret = null;
/*
if (parent.IsPhysical)
ret = new BSLinksetConstraints(physScene, parent);
else
ret = new BSLinksetManual(physScene, parent);
*/
// at the moment, there is only one
ret = new BSLinksetConstraints(physScene, parent);
return ret;
}
示例11: Refresh
// When physical properties are changed the linkset needs to recalculate
// its internal properties.
// May be called at runtime or taint-time (just pass the appropriate flag).
public override void Refresh(BSPhysObject requestor, bool inTaintTime)
{
// If there are no children or not root, I am not the one that recomputes the constraints
if (!HasAnyChildren || !IsRoot(requestor))
return;
BSScene.TaintCallback refreshOperation = delegate()
{
RecomputeLinksetConstraintVariables();
DetailLog("{0},BSLinkset.Refresh,complete,rBody={1}",
LinksetRoot.LocalID, LinksetRoot.BSBody.ptr.ToString("X"));
};
if (inTaintTime)
refreshOperation();
else
PhysicsScene.TaintedObject("BSLinkSet.Refresh", refreshOperation);
}
示例12: Factory
// Create the correct type of linkset for this child
public static BSLinkset Factory(BSScene physScene, BSPhysObject parent)
{
BSLinkset ret = null;
switch ((int)BSParam.LinksetImplementation)
{
case (int)LinksetImplementation.Constraint:
ret = new BSLinksetConstraints(physScene, parent);
break;
case (int)LinksetImplementation.Compound:
ret = new BSLinksetCompound(physScene, parent);
break;
case (int)LinksetImplementation.Manual:
// ret = new BSLinksetManual(physScene, parent);
break;
default:
ret = new BSLinksetCompound(physScene, parent);
break;
}
return ret;
}
示例13: IsRoot
// Return 'true' if the passed object is the root object of this linkset
public bool IsRoot(BSPhysObject requestor)
{
return (requestor.LocalID == LinksetRoot.LocalID);
}
示例14: RemoveMeFromLinkset
// Remove a child from a linkset.
// Returns a new linkset for the child which is a linkset of one (just the
// orphened child).
// Called at runtime.
public BSLinkset RemoveMeFromLinkset(BSPhysObject child)
{
lock (m_linksetActivityLock)
{
if (IsRoot(child))
{
// Cannot remove the root from a linkset.
return this;
}
RemoveChildFromLinkset(child);
}
// The child is down to a linkset of just itself
return new BSLinkset(PhysicsScene, child);
}
示例15: HasChild
// Return 'true' if this child is in this linkset
public bool HasChild(BSPhysObject child)
{
bool ret = false;
lock (m_linksetActivityLock)
{
foreach (BSPhysObject bp in m_children)
{
if (child.LocalID == bp.LocalID)
{
ret = true;
break;
}
}
}
return ret;
}