Search Unity

Baseball

Discussion in 'Scripting' started by burge51, Apr 24, 2008.

  1. burge51

    burge51

    Joined:
    Apr 16, 2008
    Posts:
    6
    Hi all, i'm still new to unity and still unsure how to do things. I want to play around and make a baseball game. The part i'm not sure of how to do is getting the first person controller to hit balls thrown at it. I have the idea to attach a bat object to my player but how do i make the player hit the balls with a force dependent on the player swing. Can anyone give me an idea of where to start.......

    Thanks


    :D
     
  2. JavaChilly

    JavaChilly

    Joined:
    Mar 8, 2008
    Posts:
    33
    You might try doing the back and forth power meter. It goes up and down and the player has to press a button at the right time to get it in the sweet spot to connect. Do the same thing for left right to control where the ball is gonna end up.

    At that point, you'll have 2 analog ranges of input. Would be fairly straight forward to add forces to the ball via an OnTriggerEnter collision handler I imagine at that point.

    That might give you an idea where to start.