21 lines
386 B
C#
21 lines
386 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Swing : MonoBehaviour
|
|
{
|
|
private Rigidbody _rb;
|
|
[SerializeField] private float torque = 30f;
|
|
|
|
void Awake()
|
|
{
|
|
_rb = GetComponent<Rigidbody>();
|
|
}
|
|
|
|
void Start()
|
|
{
|
|
_rb.WakeUp();
|
|
_rb.AddTorque(transform.right * torque, ForceMode.Impulse);
|
|
}
|
|
}
|