Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Character jump to exact position

Discussion in 'Scripting' started by CatchFires, Mar 24, 2021.

  1. CatchFires

    CatchFires

    Joined:
    Jul 19, 2020
    Posts:
    38
    Hello, I wanted to recreate a game mechanic from this random kids game my daughter plays.

    It's an endless jumper but rather then move your character left and right as it jumps, you click a platform and the character will jump above then land on it.

    How would you make something like that? It's obviously different then just simply adding force
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,756
    Definitely start with some endless runner tutorials.

    As for the motion, without seeing the game I can't say, but any type of click-to-jump-here generally involves making up a trajectory to get you from where you are to where you clicked, if possible.

    There's tutorials for doing trajectories (like arcing a ball over) that can give you an insight into generating the curve, more of them these days because it's a semi-common way to move in VR.

    You can also cheese a trajectory with something like a sine curve.
     
  3. CatchFires

    CatchFires

    Joined:
    Jul 19, 2020
    Posts:
    38
    Ah yeah, I'm good on the endless runner bits just curious how they did the jump.

    I did actually start to watch some trajectory examples earlier but wasn't sure if that was the right approach, good to know I was on the right path.

    Thanks man.
     
    Kurt-Dekker likes this.
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,756
    I think it might be viable. It gets a lot easier if there is no chance of additional input during the arc... otherwise you gotta tween it to the next arc somehow.
     
  5. CatchFires

    CatchFires

    Joined:
    Jul 19, 2020
    Posts:
    38
    Yeah, no other input until the jump has finished
     
    Kurt-Dekker likes this.