Unity SpeedPad / boost pad
Seeing as I'm almost USELESS at coding, AND using C# cause I learned about it first, I'm having a hard time making a speedpad. So, basically I want a script (preferably attached to the gameobject) to test if the player is colliding with an object called "booster" (no caps). Heres what I have right now.
using UnityEngine;
using System.Collections;
public class Speedbooster : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.name == "player")
{
GetComponent<Rigidbody>().AddForce(transform.forward * 500);
}
}
}
So, once again, if possible I want a thingy (forgot what its called ;-;) in the inspector that I can change to change the amount of speed the player gains.
Answer by Gurekam-Dhillon · Mar 25, 2016 at 05:00 AM
Revisiting this, I've learned alot, so I think I would be able to make this myself.
Follow this Question
Related Questions
How to include speed trigger creation option in this script. 0 Answers
Adding Speed 0 Answers
How to revert speed back to normal after changing with Key. 1 Answer
Something is wrong with my max. speed code 0 Answers
InvokeRepeating not working 1 Answer