Guest User

Untitled

a guest
Jul 2nd, 2020
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.49 KB | None | 0 0
  1. using UnityEngine;
  2.  
  3. public class fuck : MonoBehaviour
  4. {
  5.     private Rigidbody2D rb;
  6.  
  7.     public bool f;
  8.  
  9.     void Awake()
  10.     {
  11.         rb = GetComponent<Rigidbody2D>();
  12.     }
  13.  
  14.     void FixedUpdate()
  15.     {
  16.         Vector2 v = new Vector2(transform.position.x + Mathf.Sin(Time.time) * 10 * Time.fixedDeltaTime,
  17.             transform.position.y);
  18.        
  19.         if (f)
  20.             rb.MovePosition(v);
  21.         else
  22.         {
  23.             transform.position = v;
  24.         }
  25.     }
  26. }
Add Comment
Please, Sign In to add comment