Hey guys, here’s my Rate My Professor page, I’d really appreciate if you could leave my a good rating as it will help me finding my next job! Unfortunately it’s my last semester at MAGIC, I hope you all enjoyed the class and please keep in touch if you need any advice in the future.
Here’s the code you need to add a speed boost feature on the jet, it’s bound to Right Click (”Fire2″). Attach the script component to your aircraft (same object that has the Rigidbody component) and set the Power value on the component to something high like 5000.
I haven’t tested it on the car.
using UnityEngine;
using System.Collections;
public class SpeedBoost: MonoBehaviour {
public bool on;
public float power;
void Update () {d
if (Input.GetButton("Fire2"))
{
Debug.Log ("what the ...");
on = true;
} else {
on = false;
}
if (Input.GetAxis ("Horizontal") != null)
{
float direction = Input.GetAxis ("Horizontal");
transform.Rotate (direction,0,0);
}
if (on)
{
transform.GetComponent<Rigidbody> ().AddForce (transform.forward * power);
}
}
}
This was taken from the Thruster.cs script in the Dogfight game, they used AddForce (transform.up ... I just changed it to transform.forward. You could probably use the ‘up’ version for a jump.
You might find some useful scripts in here, scripts for invisibility, capture the flag, Halo bubble shield, camera shake, mines, lightning, slo-mo, etc.
Shield demo on the enemy AI, I’ll show you guys how to implement this next week. Code is below if you want to give it a try.
using UnityEngine;
using System.Collections;
public class DestroyShield : MonoBehaviour {
public GameObject shieldshatter; //explosion for the bullet impact
public GameObject theShield; //mesh object with hologram shader and collider trigger
public GameObject jetCollider; //destructionSensor on the AI jet
public float afterSeconds = 0.25f; //delay between impact and shield turning off
Destroy(impactObject); //destroys the bullet object, this could use another if statement so the player doesn’t get destroyed by touching the shield
Instantiate (shieldshatter, transform.position, transform.rotation); //creates a green explosion
Invoke("Trigger", afterSeconds); //destroys the shield after a short delay, and also activate the destruction trigger so the aircraft can be destroyed
}
}
void Trigger()
{
Destroy(theShield); //destroys the shield object
jetCollider.GetComponent<BoxCollider>().enabled = true; //activates the destruction sensor so now the aircraft destruction collider can destroy the aircraft
}
}
0 notes
Statistics
We looked inside some of the posts by
magicui
and here's what we found interesting.
Average Info
Notes Per Post
17
Likes Per Post
10
Reblog Per Post
7
Reply Per Post
0
Time Between Posts
2 days
Number of Posts By Type
Link
4
Text
7
Video
6
Explore Tagged Posts
Fun Fact
US Tumblr user growth rate is estimated to slow down to 4.1%.