Quest: Worm Wars Quest
Challenge: Gone With The Wind
Feel free to share your solutions, ideas and creations below. If you get stuck, you can find some ideas here for completing this challenge.
Quest: Worm Wars Quest
Challenge: Gone With The Wind
Feel free to share your solutions, ideas and creations below. If you get stuck, you can find some ideas here for completing this challenge.
This was a hard challenge for me because I kept forgetting that we are working in 2D. From failing to find a RigidBody to using the wrong OnTriggerStay. Moral of the story, don’t forget to add 2D!
My solution:
void OnTriggerStay2D(Collider2D other)
{
if (other.gameObject.layer == LayerMask.NameToLayer("Projectile"))
{
// Debug.Log("Object is in trigger");
other.GetComponent<Rigidbody2D>().AddForce(Vector2.right * windFactor * windMultiplier);
}
}