티스토리 뷰
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
'Unity' 카테고리의 다른 글
<Unity> object의 origin을 표시하고 싶을 때 (0) | 2017.02.14 |
---|---|
<Unity> 부모 object의 transform 정보 부르기 (0) | 2017.02.14 |
<Unity> Unity에서 object의 origin 설정해주기 (0) | 2017.02.14 |
<Unity> unity build setting에서 'web player'가 없다? (0) | 2017.01.18 |
<Unity> Unity에 확장자가 다른 mesh를 import하는 법! (0) | 2017.01.04 |
- Total
- Today
- Yesterday