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


C# model.SetRepulsion方法代码示例

本文整理汇总了C#中model.SetRepulsion方法的典型用法代码示例。如果您正苦于以下问题:C# model.SetRepulsion方法的具体用法?C# model.SetRepulsion怎么用?C# model.SetRepulsion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在model的用法示例。


在下文中一共展示了model.SetRepulsion方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddPhysicRepresentation

        /// <summary>
        /// This function adds (if necessary) a particle to the physics engine as a representation of the node passed in argument
        /// </summary>
        /// <param name="x">the x coordinate</param>
        /// <param name="y">the y coordinate</param>
        /// <param name="z">the z coordinate</param>
        /// <param name="node">the node you want to represent in the physics engine</param>
        /// <param name="model">the model manager. It's used to create interactions</param>
        public void AddPhysicRepresentation(float x, float y, float z, model.Node node, model.ModelManager model)
        {
            // if the node already exists and already has a physic representation then don't do anything, go back to where you come from.
            if (node.PhysicRepresentation != null)
            {
                return;
            }

            // else we create a physic representation
            Particle particle = this.particleSystem.MakeParticle(x, y, z);

            // create some space between the nodes
            foreach (model.Node otherNode in model.NodeList)
            {
                if (otherNode.PhysicRepresentation != null)
                {
                    physics.Attraction repulsion = this.particleSystem.MakeAttraction(
                         otherNode.PhysicRepresentation,
                         particle,
                         -1 * this.settings.RepultionForce,
                         PhysicsConstants.AttractionEffectMinimalDistance);
                    node.SetRepulsion(otherNode, repulsion);
                    otherNode.SetRepulsion(node, repulsion);
                }
            }

            // finally set the particle
            node.PhysicRepresentation = particle;
        }
开发者ID:khanhduy94,项目名称:jobzoom,代码行数:37,代码来源:PhysicsManager.cs


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