本文整理汇总了C#中Joint类的典型用法代码示例。如果您正苦于以下问题:C# Joint类的具体用法?C# Joint怎么用?C# Joint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Joint类属于命名空间,在下文中一共展示了Joint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Gesture
public Gesture(DateTime timestamp, double magnitude, GestureID id, Joint guestureSource)
{
this._timestamp = timestamp;
this._magnitude = magnitude;
this._id = id;
this._guestureSource = guestureSource;
}
示例2: KinectSkeleton
public KinectSkeleton(Joint ankleLeft, Joint ankleRight, Joint elbowLeft, Joint elbowRight, Joint footLeft,
Joint footRight, Joint handLeft, Joint handRight, Joint head, Joint hipCenter,
Joint hipLeft, Joint hipRight, Joint kneeLeft, Joint kneeRight, Joint shoulderCenter,
Joint shoulderLeft, Joint shoulderRight, Joint spine, Joint wristLeft, Joint wristRight)
{
this.ankleLeft = ankleLeft;
this.ankleRight = ankleRight;
this.elbowLeft = elbowLeft;
this.elbowRight = elbowRight;
this.footLeft = footLeft;
this.footRight = footRight;
this.handLeft = handLeft;
this.handRight = handRight;
this.head = head;
this.hipCenter = hipCenter;
this.hipLeft = hipLeft;
this.hipRight = hipRight;
this.kneeLeft = kneeLeft;
this.kneeRight = kneeRight;
this.shoulderCenter = shoulderCenter;
this.shoulderLeft = shoulderLeft;
this.shoulderRight = shoulderRight;
this.spine = spine;
this.wristLeft = wristLeft;
this.wristRight = wristRight;
}
示例3: Direction
public Direction(Joint i, Joint j)
{
createDirection(
j.Position.X - i.Position.X,
j.Position.Y - i.Position.Y,
j.Position.Z - i.Position.Z);
}
示例4: SetUIElementPosition
private void SetUIElementPosition(FrameworkElement element, Joint joint, int yOffset)
{
var scaledJoint = joint.ScaleTo(1024, 768, .99f, .99f);
Canvas.SetLeft(element, scaledJoint.Position.X);
Canvas.SetTop(element, scaledJoint.Position.Y - yOffset);
}
示例5: detectWalking
/// <summary>
/// Process walking/running. Calculates how far forward the right foot
/// is from the left foot.
/// </summary>
/// <param name="rightFoot"></param>
/// <param name="leftFoot"></param>
private void detectWalking(Joint rightFoot, Joint leftFoot) {
double feetDifferential = leftFoot.Position.Z - rightFoot.Position.Z;
// Move forward
if (feetDifferential > walkThresh)
{
if (feetDifferential > runThresh)
{
InputSimulator.SimulateKeyDown(VirtualKeyCode.VK_2);
}
else
{
InputSimulator.SimulateKeyDown(VirtualKeyCode.VK_W);
}
}
// Move backward
else if (feetDifferential < -walkThresh)
{
InputSimulator.SimulateKeyDown(VirtualKeyCode.VK_S);
}
else
{
if (InputSimulator.IsKeyDown(VirtualKeyCode.VK_W)) InputSimulator.SimulateKeyUp(VirtualKeyCode.VK_W);
if (InputSimulator.IsKeyDown(VirtualKeyCode.VK_S)) InputSimulator.SimulateKeyUp(VirtualKeyCode.VK_S);
if (InputSimulator.IsKeyDown(VirtualKeyCode.VK_2)) InputSimulator.SimulateKeyUp(VirtualKeyCode.VK_2);
}
}
示例6: SetGrapple
void SetGrapple(GameObject targ, int grappleType)
{
if (targ == null) return;
if (curTarget != null) FreeGrapple ();
swinging = true;
curTarget = targ;
Rigidbody targRigid = curTarget.GetComponent<Rigidbody> ();
if (targRigid != null) {
if (grappleType == 0) {
HingeJoint target_hinge = targRigid.gameObject.AddComponent <HingeJoint> ();
target_hinge.connectedBody = rigid;
// parentRigid.isKinematic = true;
target_hinge.autoConfigureConnectedAnchor = false;
target_hinge.connectedAnchor = targRigid.transform.position;
hingeTarget = target_hinge;
// target_hinge.maxDistance = 50;
// target_hinge.minDistance = 45;
} else if (grappleType == 1) {
SpringJoint target_spring = targRigid.gameObject.AddComponent <SpringJoint> ();
target_spring.connectedBody = rigid;
target_spring.autoConfigureConnectedAnchor = false;
target_spring.connectedAnchor = targRigid.transform.position;
target_spring.maxDistance = 50;
target_spring.minDistance = 5;
hingeTarget = target_spring;
}
}
}
示例7: release
public void release()
{
Joint oldGrip = grip;
grip = null;
Object.Destroy(oldGrip);
grabee = null;
}
示例8: Grammar
public Grammar()
{
Options = RuntimeOptions.Default;
Productions = new ProductionCollection(this);
Symbols = new SymbolCollection(this);
Conditions = new ConditionCollection(this);
Matchers = new MatcherCollection(this);
Mergers = new MergerCollection(this);
Contexts = new ForeignContextCollection(this);
Reports = new ReportCollection();
GlobalContextProvider = new ForeignContextProvider { Owner = this.Contexts };
Joint = new Joint();
for (int i = PredefinedTokens.Count; i != 0; --i)
{
Symbols.Add(null); // stub
}
Symbols[PredefinedTokens.Propagated] = new Symbol("#");
Symbols[PredefinedTokens.Epsilon] = new Symbol("$eps");
Symbols[PredefinedTokens.AugmentedStart] = new Symbol("$start");
Symbols[PredefinedTokens.Eoi] = new Symbol("$")
{
Categories = SymbolCategory.DoNotInsert
| SymbolCategory.DoNotDelete
};
Symbols[PredefinedTokens.Error] = new Symbol("$error");
AugmentedProduction = Productions.Define((Symbol)Symbols[PredefinedTokens.AugmentedStart], new Symbol[] { null });
}
示例9: NullCanBeAddedAndHasNoEffect
public void NullCanBeAddedAndHasNoEffect()
{
var target = new Joint();
target.Add(null);
Assert.IsFalse(target.Has<object>());
Assert.IsNull(target.Get<object>());
Assert.Throws<InvalidOperationException>(() => target.The<object>());
}
示例10: vectorFromJoint
public static Vector3D vectorFromJoint(Joint j)
{
Vector3D v = new Vector3D();
v.X = j.Position.X;
v.Y = j.Position.Y;
v.Z = j.Position.Z;
return v;
}
示例11: OnCollisionEnter
void OnCollisionEnter(Collision col)
{
if (col.gameObject.name == "BrickNew (5)")
{
theJoint = gameObject.AddComponent<FixedJoint>();
theJoint.connectedBody = col.rigidbody;
}
}
示例12: Awake
public new void Awake() {
base.Awake();
_path = transform.Find("Path").GetComponent<BoxCollider>();
_cursor = transform.Find("Path/Cursor").GetComponent<Joint>();
_slothSnapper = GameObject.FindGameObjectWithTag("SlothNinja").GetComponent<Snapper>();
}
示例13: OnCollisionEnter
// OnCollisionEnter is called when this
// collider/rigidbody has begun touching
// another rigidbody/collider.
void OnCollisionEnter(Collision collision)
{
Linkable linkee = collision.gameObject.GetComponent<Linkable>();
if (linkee != null) {
joint = this.gameObject.AddComponent<FixedJoint>();
joint.connectedBody = linkee.gameObject.rigidbody;
}
}
示例14: NetworkLink
public static List<GameObject> NetworkLink(Vector3 currentPosition, Vector3 finalPosition, Joint hook, Rigidbody anchor, bool gravity)
{
List<GameObject> links = new List<GameObject>();
GameObject link = ResourceFactory.GetInstance().GetPrefab(Registry.Prefab.ChainLink);
float linkHeight = link.GetComponent<Renderer>().bounds.max.y * 2;
// Get any vector perpindicular to the direction towards the bird in order to get the Quaternion
Vector3 direction = finalPosition - currentPosition;
Vector3 forward = Vector3.RotateTowards(direction, -direction, Mathf.PI/2f, 0);
Quaternion linkRotation = Quaternion.LookRotation(forward, direction);
GameObject currentLink = null;
ConfigurableJoint prevBody = null;
while(Vector3.Distance(currentPosition, finalPosition) > linkHeight)
{
if(uLink.Network.isServer)
{
currentLink = uLink.Network.Instantiate(uLink.Network.player, Registry.Prefab.ProxyChainLink, Registry.Prefab.ServerChainLink,
Registry.Prefab.ServerChainLink, currentPosition, linkRotation, 0);
}
else
{
currentLink = uLink.Network.Instantiate(uLink.Network.player, Registry.Prefab.ProxyChainLink, Registry.Prefab.ServerChainLink,
Registry.Prefab.ProxyChainLink, currentPosition, linkRotation, 0);
}
currentLink.transform.parent = hook.transform;
currentPosition += currentLink.transform.up * linkHeight;
links.Add(currentLink);
Rigidbody currentBody = currentLink.GetComponent<Rigidbody>();
currentBody.useGravity = gravity;
if(hook.connectedBody == null)
{
hook.connectedBody = currentBody;
}
else
{
ConnectJoint(prevBody, currentBody);
}
prevBody = currentLink.GetComponent<ConfigurableJoint>();
}
if(anchor != null)
{
ConnectJoint(currentLink.GetComponent<ConfigurableJoint>(), anchor);
}
else
{
currentLink.GetComponent<ConfigurableJoint>().connectedAnchor = finalPosition;
}
currentLink.GetComponent<ConfigurableJoint>().autoConfigureConnectedAnchor = true;
return links;
}
示例15: Plane
/*
Constructor: Plane
Initializes x,y,z.
*/
public Plane(Joint a, Joint b, Joint c)
{
Direction d1 = new Direction(a, b);
Direction d2 = new Direction(a, c);
Direction per = Mathematics.crossProduct(d1, d2);
x = per.x;
y = per.y;
z = per.z;
}