Search Unity

Control puck action using one key

Discussion in 'Scripting' started by showdowndev1, Jul 9, 2020.

  1. showdowndev1

    showdowndev1

    Joined:
    Jul 7, 2020
    Posts:
    2
    I am creating an air hockey game in Unity using C#, but I want the puck to move in a certain way or trajectory by hitting a letter on a keyboard. For example, if the user hits the letter "S", I want the puck to move in a certain trajectory and bounce off a boundary. I am new to C# and unity so I am very confused at how to go about this. Any thoughts/suggestions/tutorials?
     
  2. Cyber-Dog

    Cyber-Dog

    Joined:
    Sep 12, 2018
    Posts:
    352
    You would need to work with several components, non-wich I can think of that would be covered in a single tutorial.

    You would need to work with Input, Colliders, Transforms, RigidBodies etc... So you really just need to get an all-round understanding before writing your own thing.

    Why not start with these unity tutorials. It's highly beneficial too because you will pick up on some best practices you may not notice be going at it alone. https://learn.unity.com/