本文整理汇总了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;
}