1
This commit is contained in:
26
Src/Unity/Scripts/Physics/JointBasedSync.cs
Normal file
26
Src/Unity/Scripts/Physics/JointBasedSync.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MyNamespace
|
||||
{
|
||||
public class JointBasedSync : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private ConfigurableJoint joint;
|
||||
[SerializeField] private Transform animate;
|
||||
private Quaternion _initialRotation;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_initialRotation = joint.transform.localRotation;
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
//joint.targetPosition = animate.localPosition;
|
||||
joint.targetRotation = Quaternion.Inverse(animate.localRotation) * _initialRotation;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user