blob: 39059201ae14c5053be8d4e85d1366f67f7ce327 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AddTorque : MonoBehaviour
{
public Vector3 torque;
public Rigidbody rigid;
public Transform hip;
// Start is called before the first frame update
void Start()
{
rigid = GetComponent<Rigidbody>();
}
// Update is called once per frame
void FixedUpdate()
{
Vector3 t = hip.TransformDirection(torque);
rigid.AddTorque(t, ForceMode.Acceleration);
}
}
|