示例#1
0
    public void Init(finger1 device)
    {
        GetComponent <Rigidbody>().mass       = device.config.SectionMass / 2;
        GetComponent <Rigidbody>().useGravity = device.config.UseGravity;

        transform.localScale                = new Vector3(device.config.SectionThick, device.config.SectionHeight, device.config.SectionWidth);
        transform.GetChild(0).localScale    = new Vector3(device.config.RibHeight / device.config.SectionThick, 1.0f / 3, 1.0f);
        transform.GetChild(0).localPosition = new Vector3(-0.5f * (1.0f + device.config.RibHeight / device.config.SectionThick), 0, 0);
        transform.position = pivotObject.transform.rotation * Quaternion.AngleAxis(90, Vector3.left) * (Vector3.down * device.config.SectionHeight / 2) + pivotObject.transform.position;
        transform.rotation = pivotObject.transform.rotation * Quaternion.AngleAxis(90, Vector3.left);

        joint.Config(pivotObject, gameObject, device.config.Kinematic, JointPhysics.Fixed);
    }
示例#2
0
    public void Init(finger1 device)
    {
        GetComponent <Rigidbody>().mass       = device.config.ConnectorMass;
        GetComponent <Rigidbody>().useGravity = device.config.UseGravity;

        transform.localScale = new Vector3(device.config.SectionThick, device.config.ConnectorHeight, device.config.SectionWidth);
        Vector3 ofs = device.pivot.rotation * Vector3.down * device.config.ConnectorHeight / 2;

        transform.position = device.pivot.Object.transform.rotation * (device.pivot.position + ofs) + device.pivot.Object.transform.position;
        transform.rotation = device.pivot.Object.transform.rotation * device.pivot.rotation;
        transform.rotation = device.pivot.Object.transform.rotation * device.pivot.rotation;

        joint.Config(device.pivot.Object, gameObject, device.config.Kinematic, JointPhysics.Fixed);
    }
示例#3
0
    public void Init(finger1 device)
    {
        GetComponent <Rigidbody>().mass       = device.config.SectionMass / 2;
        GetComponent <Rigidbody>().useGravity = device.config.UseGravity;

        transform.localScale = new Vector3(device.config.SectionThick, device.config.SectionWidth / CylinderFullHeight, device.config.SectionThick);
        transform.position   = pivotObject.transform.rotation * (Vector3.down * (isFirst ? device.config.ConnectorHeight : device.config.SectionHeight) / 2) + pivotObject.transform.position;
        transform.rotation   = pivotObject.transform.rotation * Quaternion.AngleAxis(90, Vector3.right);

        joint.Config(pivotObject, gameObject, device.config.Kinematic, JointPhysics.Hinge);

        drive.KinematicAngularVelocity = device.config.SectionKinematicAngularVelocity;
        drive.Proportional             = device.config.SectionACSProportional;
        drive.Integral     = device.config.SectionACSIntegral;
        drive.Differential = device.config.SectionACSDifferential;
        drive.Attach(joint);
        drive.AngleRange.SetLimits(device.config.SectionAngle0, device.config.SectionAngle1);
        drive.AngleRange.SetTarget(device.config.SectionAngle0);
    }
示例#4
0
 public void Init(finger1 device)
 {
     connection.GetComponent <connectionfinger1>().Init(device);
     section.GetComponent <sectionfinger1>().Init(device);
 }