Fly back in a wind zone
This is an interesting question. So, I've successfully created a working wind zone, but I want to add something more. I want to make it so when the player jumps, they move in the same direction as the wind direction, like they can't move forward unless grounded.
private void FixedUpdate()
{
if(inWindZone)
{
rig.AddForce(windZone.GetComponent<WindArea>().direction * windZone.GetComponent<WindArea>().strength);
if(Input.GetKeyDown(KeyCode.Space))
{
}
}
}
void OnTriggerEnter(Collider other)
{
if(other.gameObject.tag == "windArea")
{
windZone = other.gameObject;
//inWindZone = true;
StartCoroutine(delayWind());
}
}
void OnTriggerExit(Collider other)
{
if(other.gameObject.tag == "windArea")
{
inWindZone = false;
}
}
can you share your movement code too...i think it's necessary to work with this
Oh there actually isn't much in the movement code. It's just the public float strength and public Vector3 direction.
well no i mean, in order to stop player inputs from working, it's necessary to have a look at the movement script if you don't $$anonymous$$d
Your answer
![](https://koobas.hobune.stream/wayback/20220613042353im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to jump a bunch of players like a wave which are moving in endless platformer? 1 Answer
my 2d character isnt jumping with constant velocity on applying force 1 Answer
rigid.velocity.x = 0 for unknow reason 0 Answers
C# keep previous velocity while jumping, previous solutions not working 0 Answers