Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.72 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class Physics : MonoBehaviour
  6. {
  7.     public Vector3 Force;
  8.     public Vector3 Acceleration;
  9.     public int stretch;
  10.     public Vector3 Velocity;
  11.     public int mass;
  12.     public Vector3 startForce;
  13.  
  14.     // Start is called before the first frame update
  15.     void Start()
  16.     {
  17.  
  18.     }
  19.  
  20.     // Update is called once per frame
  21.     void Update()
  22.     {
  23.        
  24.     }
  25.  
  26.     void FixedUpdate()
  27.     {
  28.        
  29.         Force = -stretch * transform.position - 1 * Velocity;
  30.         Acceleration = Force / mass;
  31.         Velocity += Acceleration * Time.deltaTime;
  32.         transform.position += Velocity * Time.deltaTime;
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement