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 BossVelocity : MonoBehaviour {
- public float MoveSpeed = 1.5f;
- public static float MoveSpeedStatic = 1.5f;
- private float frequency = 5f; // Speed of sine movement
- private float magnitude = 2.5f; // Size of sine movement
- private Vector3 axis;
- private Vector3 pos;
- void Start () {
- pos = transform.position;
- axis = transform.up;
- }
- void FixedUpdate () {
- pos -= transform.right * Time.deltaTime * MoveSpeed;
- transform.position = pos + axis * Mathf.Sin (Time.time * frequency) * magnitude;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement