I’m trying tot make a game like redball and if you have ever played redball you would see that there are platforms that lauch the ball into the air. How can I copy this.
I don’t know Redball but you can add a trigger volume to that platform, once the player triggers the volume, you can set the Y velocity of it’s rigidbody to something high enough to shoot the player into the air. Gravity will take care of the rest.
Try adding a tag to the platform called “launcher” or something like that and then in your player controller script: add an if statement that would check the tag on the platform and inside the if statement add a rigidbody AddForce to move the player up.
Something like this (I am NOT an expert so, loosely follow this):
public float VerticalForce1 = 10f; //Change this for your launching power
Vector2 VerticalLauncher = (0, VerticalForce1);
void OnTriggerEnter2D(Collider2D other)
{
if (other.gameObject.CompareTag ("launcher"))
{
rb2d.AddForce (VerticalLauncher);
}
}