- Home /
Question by
zak666 · Aug 23, 2016 at 12:53 PM ·
scriptingbasics
Axis disabled? (IO have not changed default input except fire1 and fire2) ?
oil this script is finished however i press input and nothing appears to happen on screen (script is on a cube) however in rotation in inspector i see the values changing. Yes i have reseted my computer and restarted unity.
using UnityEngine;
using System.Collections;
public class PlayerControllerWizards : MonoBehaviour {
public float Speed = 20;
public float turnspeed = 50;
public float BoosterSpeed = 30f;
//Ammo/guncontroll
public GameObject MachGunBullets;
public GameObject Explosion;
public AudioClip HitAudio;
public AudioClip Explostion;
public AudioClip Machshot;
// Booster Controll
public Light Thrusterlight;
public Light Thrusterlight2;
public bool Iscontrollable = true;
public RaycastHit Hit;
void LateUpdate () {
transform.Translate (Vector3.forward * Speed * Time.deltaTime);
Vector3 fwd = transform.TransformDirection(Vector3.forward); //the direction the player is facing
//Spaceshipcontrolles________________________________________________________________________________________
float horizontal = Input.GetAxis ("Horizontal") * turnspeed * Time.deltaTime;
float vertical = Input.GetAxis ("Vertical") * turnspeed * Time.deltaTime;
horizontal *= Time.deltaTime;
vertical *= Time.deltaTime;
transform.Rotate (Vector3.up, horizontal);
transform.Rotate (Vector3.right, vertical);
//Gunm-Fire Controll____________________________________________________________________________________________
if (Input.GetButton ("Shoot")) {
MachGunBullets.SetActive (true);
RaycastHit hit = new RaycastHit ();
if (Physics.Raycast (transform.position, fwd, 10))
if (Hit.collider.tag == "Red_Team_fighter") {
Hit.collider.SendMessageUpwards ("MachGunsDamage", SendMessageOptions.DontRequireReceiver);
}
if (Hit.collider.tag == "Blue_Team_fighter") {
Hit.collider.SendMessageUpwards ("MachGunsDamage", SendMessageOptions.DontRequireReceiver);
}
} else {
MachGunBullets.SetActive (false);
}
// END RAYCAST
//Booster Controll________________________________________________________________________________________
if (Input.GetButton ("Boost")) {
transform.Translate (Vector3.forward * BoosterSpeed * Time.deltaTime);
Thrusterlight.intensity = 0.7f;
Thrusterlight2.intensity = 0.7f;
}
if (Input.GetButtonUp ("Boost")) {
Thrusterlight.intensity = 0.44f;
Thrusterlight2.intensity = 0.44f;
}
}
// End Late Update________________________________________________________________________________________
}
Comment
Your answer
Follow this Question
Related Questions
Creating complex colliders 1 Answer
Animation stop script (very simple question) 0 Answers
How can I compare a sequence of GameObjects when tapped? 1 Answer
Object modified in script not modified in scene 0 Answers
How i get my cloud position in other script? I want to use this temp value in other script. 1 Answer