08-06-2013 11:29 AM
/* ZB
// reduce by half to avoid getting ill
if (Input.GetKey(KeyCode.Q))
YRotation -= rotateInfluence * 0.5f;
if (Input.GetKey(KeyCode.E))
YRotation += rotateInfluence * 0.5f;
*/ //ZB
private float minimumY = -360F; //ZB
private float maximumY = 360F; //ZB
float rotateInfluence = DeltaTime * RotationAmount * RotationScaleMultiplier;
if (Input.GetKey(KeyCode.Q))
{
//Get the this and rotate it to the left so -= rotateInfluence * 0.5f;
float fYRot = transform.rotation.x - rotateInfluence * 0.5f;
fYRot = Mathf.Clamp (fYRot, minimumY, maximumY);
DirXform.transform.localEulerAngles = new Vector3(transform.localEulerAngles.x, fYRot, 0);
}
if (Input.GetKey(KeyCode.E))
{
// Get this and rotate it to the right so += rotateInfluence * 0.5f;
float fYRot = transform.rotation.x + rotateInfluence * 0.5f;
fYRot = Mathf.Clamp (fYRot, minimumY, maximumY);
DirXform.transform.localEulerAngles = new Vector3(transform.localEulerAngles.x, fYRot, 0);
}
08-07-2013 09:33 AM
using UnityEngine;
using System.Collections;
public class QERotate : MonoBehaviour {
public float speed = 180f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
float left = 0;
float right = 0;
if(Input.GetKey(KeyCode.Q))
{
left = 1;
}
if(Input.GetKey(KeyCode.E))
{
right = 1;
}
transform.Rotate(new Vector3(
0,
(
-(left*speed)+
(right*speed)
)*Time.deltaTime,
0));
}
}
08-07-2013 11:21 AM
08-07-2013 11:38 AM
if (Input.GetKey(KeyCode.Q))
{
//Get the this and rotate it to the left so -= rotateInfluence * 0.5f;
float fYRot = transform.rotation.y - rotateInfluence * 0.5f;
fYRot = Mathf.Clamp (fYRot, minimumY, maximumY);
transform.Rotate(new Vector3(transform.localEulerAngles.x, fYRot, transform.localEulerAngles.z));
}
if (Input.GetKey(KeyCode.E))
{
// Get this and rotate it to the right so += rotateInfluence * 0.5f;
float fYRot = transform.rotation.y + rotateInfluence * 0.5f;
fYRot = Mathf.Clamp (fYRot, minimumY, maximumY);
transform.Rotate(new Vector3(transform.localEulerAngles.x, fYRot, transform.localEulerAngles.z));
}
08-07-2013 01:04 PM
08-08-2013 02:17 PM
08-08-2013 03:07 PM
transform.Rotate(new vector3(3,0,0));
if (Input.GetKey(KeyCode.Q))
{
//turn left
transform.Rotate(new Vector3(0f, -rotateInfluence * 0.5f,0f));
}
if (Input.GetKey(KeyCode.E))
{
//turn right
transform.Rotate(new Vector3(0f, rotateInfluence * 0.5f,0f));
}
08-10-2013 11:37 AM