I’m trying to create Flappy Bird as a tool to learn Unity & essentially I’ve added this script to the “pipes”. When I remove the Collider they work perfectly fine, but obviously I need the collider for them to function properly. When I add the collider they just sit there & bump into each other.
Any ideas?
#pragma strict
public var speed : int;
function Start () {
var newSpeed : Vector2;
newSpeed.x = speed;
newSpeed.y = 0;
GetComponent.<Rigidbody2D>().AddForce(newSpeed);
}
Ok, so you need the colliders to see when the player hits them, but you don’t want them to hit each other. This is actually simple. Click the checkbox on your pipe colliders to make them triggers. Then in the player, look for trigger events.
Now, this will have the unfortunate side effect of the player not actually colliding with the pipes, but if this is to be like the original flappy bird, that is fine since as soon as the collision occurs the player is dead anyways.