Is it at all possible to have the player activate a trigger and then code it as though a keyboard button has been pressed? Like my player enters an area and then jumps like someone hit the space bar. What would be a good script for that?
Imagine that you have a “jump” method. It’s a nice method allowing you to make the player jump. As it works pretty well you decide to call it when the space key is pressed. That’s cool. And as it’s pretty awesome you decide to call is also when a trigger is activated.
Then you have the solution.
first write a function Jump where you make your charecter jump. then in the function OnTrrigerEnter() call jump.
void OnTriggerEnter(Collider other)
{
if(other.tag == "UR Area")
{
Jump();
}
}
void Jump()
{
//make your charecter jump. better put the code inside - if (Input.GetButton("Jump")){ } here
}