Skip to content

Instantly share code, notes, and snippets.

@mohamedbark
Created October 20, 2018 11:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mohamedbark/93700fe89af9e8403ab72e7853fa945a to your computer and use it in GitHub Desktop.
Save mohamedbark/93700fe89af9e8403ab72e7853fa945a to your computer and use it in GitHub Desktop.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class objectCreator : MonoBehaviour {
float mSpeed;
float degree;
float input;
// Use this for initialization
public GameObject cylinder1;
public GameObject grip1,grip2;
void Start () {
mSpeed = 20f;
degree = 90;
}
// Update is called once per frame
void Update () {
//
/*
float z = Input.GetAxis("Horizontal") * 15.0f; // might be negative, just test it
Vector3 euler = transform.localEulerAngles;
euler.z = Mathf.Lerp(euler.z, z, 2.0f * Time.deltaTime);
transform.localEulerAngles = euler;
*/
/*
input = Input.GetAxis("Vertical");
if (input > 0)
{
degree += 20;
}else if(input < 0)
{
degree -= 20;
}
if (degree < 0)
{
degree = 0;
}
else if (degree > 180)
{
degree = 180;
}
*/
transform.RotateAround(cylinder1.transform.position, Vector3.back, -1 *mSpeed * Input.GetAxis("Vertical") * Time.deltaTime);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment