Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Physics : MonoBehaviour
- {
- public Vector3 Force;
- public Vector3 Acceleration;
- public int stretch;
- public Vector3 Velocity;
- public int mass;
- public Vector3 startForce;
- // Start is called before the first frame update
- void Start()
- {
- }
- // Update is called once per frame
- void Update()
- {
- }
- void FixedUpdate()
- {
- Force = -stretch * transform.position - 1 * Velocity;
- Acceleration = Force / mass;
- Velocity += Acceleration * Time.deltaTime;
- transform.position += Velocity * Time.deltaTime;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement