本文整理汇总了C#中LinkType.GetJointStrength方法的典型用法代码示例。如果您正苦于以下问题:C# LinkType.GetJointStrength方法的具体用法?C# LinkType.GetJointStrength怎么用?C# LinkType.GetJointStrength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LinkType
的用法示例。
在下文中一共展示了LinkType.GetJointStrength方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateJoint
public void CreateJoint(Rigidbody originBody, Rigidbody targetBody, LinkType type, Vector3 anchorPosition)
{
if (HighLogic.LoadedSceneIsFlight && this.part != null && this.part.attachJoint != null && this.part.attachJoint.Joint != null)
{
this.part.attachJoint.Joint.breakForce = Mathf.Infinity;
this.part.attachJoint.Joint.breakTorque = Mathf.Infinity;
if (!this.IsFreeAttached && this.Target != null && this.Target.part != null && this.Target.part.attachJoint != null && this.Target.part.attachJoint.Joint != null)
{
this.Target.part.attachJoint.Joint.breakForce = Mathf.Infinity;
this.Target.part.attachJoint.Joint.breakTorque = Mathf.Infinity;
}
}
var breakForce = type.GetJointStrength();
this.LinkType = type;
if (!this.IsFreeAttached)
{
var moduleActiveStrut = this.Target;
if (moduleActiveStrut != null)
{
moduleActiveStrut.LinkType = type;
this.IsOwnVesselConnected = moduleActiveStrut.vessel == this.vessel;
}
}
else
{
this.IsOwnVesselConnected = this.FreeAttachPart.vessel == this.vessel;
}
if (!this.IsEnforced || Config.Instance.GlobalJointWeakness)
{
this._joint = originBody.gameObject.AddComponent<ConfigurableJoint>();
this._joint.connectedBody = targetBody;
this._joint.breakForce = this._joint.breakTorque = breakForce;
this._joint.xMotion = ConfigurableJointMotion.Locked;
this._joint.yMotion = ConfigurableJointMotion.Locked;
this._joint.zMotion = ConfigurableJointMotion.Locked;
this._joint.angularXMotion = ConfigurableJointMotion.Locked;
this._joint.angularYMotion = ConfigurableJointMotion.Locked;
this._joint.angularZMotion = ConfigurableJointMotion.Locked;
this._joint.projectionAngle = 0f;
this._joint.projectionDistance = 0f;
this._joint.anchor = anchorPosition;
}
else
{
this._manageAttachNode(breakForce);
}
this.PlayAttachSound();
}