what is the best way to make an ramp that can be adjusted in game. can you explain that code so that i know how it works to make it easier to teach other students.
link:example
public Transform ramp;
void Start()
{
}
void Update()
{
if (Input.GetKey(KeyCode.W))
{
ramp.Rotate(1*Time.DeltaTime,0,0);
}
if (Input.GetKey(KeyCode.S))
{
ramp.Rotate(-1*Time.DeltaTime,0,0);
}
}
All you have to do is to drag and drop the ramp (just a box) into the ramp variable slot,@Killerman4002 02 Do you want a key binded to it?
if so the code should be pretty simple
public Transform ramp;
void Start()
{
}
void Update()
{
if (Input.GetKey(KeyCode.W))
{
ramp.Rotate(1*Time.DeltaTime,0,0);
}
if (Input.GetKey(KeyCode.S))
{
ramp.Rotate(-1*Time.DeltaTime,0,0);
}
}
Then just drag and drop the ramp into the variable slot