﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace Arugula.Prototypical
{


    [RequireComponent(typeof(Rigidbody))]
    public class AddConstantForce : MonoBehaviour
    {
        public Vector3 force;
        public ForceMode mode = ForceMode.Acceleration;
        public Space space = Space.World;
        Rigidbody rb;
        // Start is called before the first frame update
        void Start()
        {
            rb = GetComponent<Rigidbody>();
        }

        // Update is called once per frame
        void FixedUpdate()
        {
            if (space == Space.World)
            {
                rb.AddForce(force, mode);
            }
            else
            {
                rb.AddRelativeForce(force, mode);
            }

        }
    }
}