Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- public class fuck : MonoBehaviour
- {
- private Rigidbody2D rb;
- public bool f;
- void Awake()
- {
- rb = GetComponent<Rigidbody2D>();
- }
- void FixedUpdate()
- {
- Vector2 v = new Vector2(transform.position.x + Mathf.Sin(Time.time) * 10 * Time.fixedDeltaTime,
- transform.position.y);
- if (f)
- rb.MovePosition(v);
- else
- {
- transform.position = v;
- }
- }
- }
Add Comment
Please, Sign In to add comment