티스토리 뷰

Configurable joint 사용하기



using UnityEngine;

using System.Collections;


public class link8_con : MonoBehaviour {

    

// Use this for initialization

void Start () {

        ConfigurableJoint joint7 = GetComponent<ConfigurableJoint>();

        joint7.anchor = new Vector3 (0, 0, 12.203f);

        joint7.axis = Vector3.forward;


        joint7.secondaryAxis = Vector3.right;

        joint7.xMotion = ConfigurableJointMotion.Locked;

        joint7.yMotion = ConfigurableJointMotion.Locked;

        joint7.zMotion = ConfigurableJointMotion.Locked;

        joint7.angularXMotion = ConfigurableJointMotion.Free;

        joint7.angularYMotion = ConfigurableJointMotion.Locked;

        joint7.angularZMotion = ConfigurableJointMotion.Locked;


        joint7.targetAngularVelocity = new Vector3(0.5f, 0, 0);


        JointDrive drive = new JointDrive();

        drive.positionDamper = 3.402823e+38f;

        drive.maximumForce = 3.402823e+38f;

        joint7.angularXDrive = drive;

    }


    // Update is called once per frame

    //void Update () {}

}


=================================================================================================================

실행하면

->


=================================================================================================================

참고로 Anchor는 local coordinate이다. Connected Anchor는 global.

위의 조인트가 부착된 메쉬는 오리진이 (0, 0, 0)이어서 저런 결과가 나온 것


참고

http://openwiki.kr/unity/class-configurablejoint

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday