当前位置: 首页>>代码示例>>C#>>正文


C# BulletSPlugin.BSPrimLinkable类代码示例

本文整理汇总了C#中OpenSim.Region.Physics.BulletSPlugin.BSPrimLinkable的典型用法代码示例。如果您正苦于以下问题:C# BSPrimLinkable类的具体用法?C# BSPrimLinkable怎么用?C# BSPrimLinkable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BSPrimLinkable类属于OpenSim.Region.Physics.BulletSPlugin命名空间,在下文中一共展示了BSPrimLinkable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BSLinkInfoConstraint

 public BSLinkInfoConstraint(BSPrimLinkable pMember)
     : base(pMember)
 {
     constraint = null;
     ResetLink();
     member.PhysScene.DetailLog("{0},BSLinkInfoConstraint.creation", member.LocalID);
 }
开发者ID:BogusCurry,项目名称:arribasim-dev,代码行数:7,代码来源:BSLinksetConstraints.cs

示例2: Factory

    // Create the correct type of linkset for this child
    public static BSLinkset Factory(BSScene physScene, BSPrimLinkable parent)
    {
        BSLinkset ret = null;

        switch (parent.LinksetType)
        {
            case LinksetImplementation.Constraint:
                ret = new BSLinksetConstraints(physScene, parent);
                break;
            case LinksetImplementation.Compound:
                ret = new BSLinksetCompound(physScene, parent);
                break;
            case LinksetImplementation.Manual:
                // ret = new BSLinksetManual(physScene, parent);
                break;
            default:
                ret = new BSLinksetCompound(physScene, parent);
                break;
        }
        if (ret == null)
        {
            physScene.Logger.ErrorFormat("[BULLETSIM LINKSET] Factory could not create linkset. Parent name={1}, ID={2}", parent.Name, parent.LocalID);
        }
        return ret;
    }
开发者ID:BogusCurry,项目名称:arribasim-dev,代码行数:26,代码来源:BSLinkset.cs

示例3: BSLinksetCompoundInfo

    // 'centerDisplacement' is the distance from the root the the center-of-mass (Bullet 'zero' of the shape)
    public BSLinksetCompoundInfo(int indx, BSPrimLinkable root, BSPrimLinkable child, OMV.Vector3 centerDisplacement)
    {
        // Each child position and rotation is given relative to the center-of-mass.
        OMV.Quaternion invRootOrientation = OMV.Quaternion.Inverse(root.RawOrientation);
        OMV.Vector3 displacementFromRoot = (child.RawPosition - root.RawPosition) * invRootOrientation;
        OMV.Vector3 displacementFromCOM = displacementFromRoot - centerDisplacement;
        OMV.Quaternion displacementRot = child.RawOrientation * invRootOrientation;

        // Save relative position for recomputing child's world position after moving linkset.
        Index = indx;
        OffsetFromRoot = displacementFromRoot;
        OffsetFromCenterOfMass = displacementFromCOM;
        OffsetRot = displacementRot;
    }
开发者ID:rryk,项目名称:omp-server,代码行数:15,代码来源:BSLinksetCompound.cs

示例4: 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(BSPrimLinkable 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();
                });
        }
    }
开发者ID:rryk,项目名称:omp-server,代码行数:18,代码来源:BSLinksetConstraints.cs

示例5: BSLinkset

        protected BSLinkset(BSScene scene, BSPrimLinkable 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 HashSet<BSPrimLinkable>();
            LinksetMass = parent.RawMass;
            Rebuilding = false;

            parent.ClearDisplacement();
        }
开发者ID:BogusCurry,项目名称:WhiteCore-Dev,代码行数:15,代码来源:BSLinkset.cs

示例6: MakeDynamic

        // The object is going dynamic (physical). Do any setup necessary for a dynamic linkset.
        // Only the state of the passed object can be modified. The rest of the linkset
        //     has not yet been fully constructed.
        // Return 'true' if any properties updated on the passed object.
        // Called at taint-time!
        public override bool MakeDynamic(BSPrimLinkable child)
        {
            bool ret = false;
            DetailLog("{0},BSLinksetCompound.MakeDynamic,call,IsRoot={1}", child.LocalID, IsRoot(child));
            if (IsRoot(child))
            {
            // The root is going dynamic. Rebuild the linkset so parts and mass get computed properly.
            ScheduleRebuild(LinksetRoot);
            }
            else
            {
            // The origional prims are removed from the world as the shape of the root compound
            //     shape takes over.
            PhysicsScene.PE.AddToCollisionFlags(child.PhysBody, CollisionFlags.CF_NO_CONTACT_RESPONSE);
            PhysicsScene.PE.ForceActivationState(child.PhysBody, ActivationState.DISABLE_SIMULATION);
            // We don't want collisions from the old linkset children.
            PhysicsScene.PE.RemoveFromCollisionFlags(child.PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);

            child.PhysBody.collisionType = CollisionType.LinksetChild;

            ret = true;
            }
            return ret;
        }
开发者ID:KSLcom,项目名称:Aurora-Sim,代码行数:29,代码来源:BSLinksetCompound.cs

示例7: BuildConstraint

    private BSConstraint BuildConstraint(BSPrimLinkable rootPrim, BSPrimLinkable childPrim)
    {
        // Zero motion for children so they don't interpolate
        childPrim.ZeroMotion(true);

        // Relative position normalized to the root prim
        // Essentually a vector pointing from center of rootPrim to center of childPrim
        OMV.Vector3 childRelativePosition = childPrim.Position - rootPrim.Position;

        // real world coordinate of midpoint between the two objects
        OMV.Vector3 midPoint = rootPrim.Position + (childRelativePosition / 2);

        DetailLog("{0},BSLinksetConstraint.BuildConstraint,taint,root={1},rBody={2},child={3},cBody={4},rLoc={5},cLoc={6},midLoc={7}",
                                        rootPrim.LocalID,
                                        rootPrim.LocalID, rootPrim.PhysBody.AddrString,
                                        childPrim.LocalID, childPrim.PhysBody.AddrString,
                                        rootPrim.Position, childPrim.Position, midPoint);

        // create a constraint that allows no freedom of movement between the two objects
        // http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4818

        BSConstraint6Dof constrain = new BSConstraint6Dof(
                            PhysicsScene.World, rootPrim.PhysBody, childPrim.PhysBody, midPoint, true, true );
                            // PhysicsScene.World, childPrim.BSBody, rootPrim.BSBody, midPoint, true, true );

        /* NOTE: below is an attempt to build constraint with full frame computation, etc.
         *     Using the midpoint is easier since it lets the Bullet code manipulate the transforms
         *     of the objects.
         * Code left for future programmers.
        // ==================================================================================
        // relative position normalized to the root prim
        OMV.Quaternion invThisOrientation = OMV.Quaternion.Inverse(rootPrim.Orientation);
        OMV.Vector3 childRelativePosition = (childPrim.Position - rootPrim.Position) * invThisOrientation;

        // relative rotation of the child to the parent
        OMV.Quaternion childRelativeRotation = invThisOrientation * childPrim.Orientation;
        OMV.Quaternion inverseChildRelativeRotation = OMV.Quaternion.Inverse(childRelativeRotation);

        DetailLog("{0},BSLinksetConstraint.PhysicallyLinkAChildToRoot,taint,root={1},child={2}", rootPrim.LocalID, rootPrim.LocalID, childPrim.LocalID);
        BS6DofConstraint constrain = new BS6DofConstraint(
                        PhysicsScene.World, rootPrim.Body, childPrim.Body,
                        OMV.Vector3.Zero,
                        OMV.Quaternion.Inverse(rootPrim.Orientation),
                        OMV.Vector3.Zero,
                        OMV.Quaternion.Inverse(childPrim.Orientation),
                        true,
                        true
                        );
        // ==================================================================================
        */

        PhysicsScene.Constraints.AddConstraint(constrain);

        // zero linear and angular limits makes the objects unable to move in relation to each other
        constrain.SetLinearLimits(OMV.Vector3.Zero, OMV.Vector3.Zero);
        constrain.SetAngularLimits(OMV.Vector3.Zero, OMV.Vector3.Zero);

        // tweek the constraint to increase stability
        constrain.UseFrameOffset(BSParam.LinkConstraintUseFrameOffset);
        constrain.TranslationalLimitMotor(BSParam.LinkConstraintEnableTransMotor,
                        BSParam.LinkConstraintTransMotorMaxVel,
                        BSParam.LinkConstraintTransMotorMaxForce);
        constrain.SetCFMAndERP(BSParam.LinkConstraintCFM, BSParam.LinkConstraintERP);
        if (BSParam.LinkConstraintSolverIterations != 0f)
        {
            constrain.SetSolverIterations(BSParam.LinkConstraintSolverIterations);
        }
        return constrain;
    }
开发者ID:rryk,项目名称:omp-server,代码行数:69,代码来源:BSLinksetConstraints.cs

示例8: RemoveChildFromLinkset

    // Remove the specified child from the linkset.
    // Safe to call even if the child is not really in my linkset.
    protected override void RemoveChildFromLinkset(BSPrimLinkable child)
    {
        if (m_children.Remove(child))
        {
            BSPrimLinkable rootx = LinksetRoot; // capture the root and body as of now
            BSPrimLinkable childx = child;

            DetailLog("{0},BSLinksetConstraints.RemoveChildFromLinkset,call,rID={1},rBody={2},cID={3},cBody={4}",
                            childx.LocalID,
                            rootx.LocalID, rootx.PhysBody.AddrString,
                            childx.LocalID, childx.PhysBody.AddrString);

            PhysicsScene.TaintedObject("BSLinksetConstraints.RemoveChildFromLinkset", delegate()
            {
                PhysicallyUnlinkAChildFromRoot(rootx, childx);
            });
            // See that the linkset parameters are recomputed at the end of the taint time.
            Refresh(LinksetRoot);
        }
        else
        {
            // Non-fatal occurance.
            // PhysicsScene.Logger.ErrorFormat("{0}: Asked to remove child from linkset that was not in linkset", LogHeader);
        }
        return;
    }
开发者ID:rryk,项目名称:omp-server,代码行数:28,代码来源:BSLinksetConstraints.cs

示例9: PhysicallyLinkAChildToRoot

 // Create a constraint between me (root of linkset) and the passed prim (the child).
 // Called at taint time!
 private void PhysicallyLinkAChildToRoot(BSPrimLinkable rootPrim, BSPrimLinkable childPrim)
 {
     // Don't build the constraint when asked. Put it off until just before the simulation step.
     Refresh(rootPrim);
 }
开发者ID:rryk,项目名称:omp-server,代码行数:7,代码来源:BSLinksetConstraints.cs

示例10: ShouldReportPropertyUpdates

    // Check the type of the link and return 'true' if the link is flexible and the
    //    updates from the child should be sent to the simulator so things change.
    public virtual bool ShouldReportPropertyUpdates(BSPrimLinkable child)
    {
        bool ret = false;

        BSLinkInfo linkInfo;
        if (m_children.TryGetValue(child, out linkInfo))
        {
            ret = linkInfo.ShouldUpdateChildProperties();
        }

        return ret;
    }
开发者ID:BogusCurry,项目名称:arribasim-dev,代码行数:14,代码来源:BSLinkset.cs

示例11: AddChildToLinkset

    // ================================================================

    // Add a new child to the linkset.
    // Called while LinkActivity is locked.
    protected override void AddChildToLinkset(BSPrimLinkable child)
    {
        if (!HasChild(child))
        {
            m_children.Add(child);

            DetailLog("{0},BSLinksetConstraints.AddChildToLinkset,call,child={1}", LinksetRoot.LocalID, child.LocalID);

            // Cause constraints and assorted properties to be recomputed before the next simulation step.
            Refresh(LinksetRoot);
        }
        return;
    }
开发者ID:rryk,项目名称:omp-server,代码行数:17,代码来源:BSLinksetConstraints.cs

示例12: BSLinksetConstraints

    // private static string LogHeader = "[BULLETSIM LINKSET CONSTRAINTS]";

    public BSLinksetConstraints(BSScene scene, BSPrimLinkable parent) : base(scene, parent)
    {
    }
开发者ID:rryk,项目名称:omp-server,代码行数:5,代码来源:BSLinksetConstraints.cs

示例13: MakeStatic

 // The object is going static (non-physical). Do any setup necessary for a static linkset.
 // Return 'true' if any properties updated on the passed object.
 // This doesn't normally happen -- OpenSim removes the objects from the physical
 //     world if it is a static linkset.
 // Called at taint-time!
 public override bool MakeStatic(BSPrimLinkable child)
 {
     // What is done for each object in BSPrim is what we want.
     return false;
 }
开发者ID:rryk,项目名称:omp-server,代码行数:10,代码来源:BSLinksetConstraints.cs

示例14: UpdateProperties

 // Called when a parameter update comes from the physics engine for any object
 //      of the linkset is received.
 // Passed flag is update came from physics engine (true) or the user (false).
 // Called at taint-time!!
 public abstract void UpdateProperties(UpdatedProperties whichUpdated, BSPrimLinkable physObject);
开发者ID:BogusCurry,项目名称:arribasim-dev,代码行数:5,代码来源:BSLinkset.cs

示例15: RemoveDependencies

 // Routine used when rebuilding the body of the root of the linkset
 // Destroy all the constraints have have been made to root.
 // This is called when the root body is changing.
 // Returns 'true' of something was actually removed and would need restoring
 // Called at taint-time!!
 public abstract bool RemoveDependencies(BSPrimLinkable child);
开发者ID:BogusCurry,项目名称:arribasim-dev,代码行数:6,代码来源:BSLinkset.cs


注:本文中的OpenSim.Region.Physics.BulletSPlugin.BSPrimLinkable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。