Search Unity

Why the club head doesn't hit the ball?

Discussion in 'Getting Started' started by NyanGoodWill, Sep 18, 2017.

  1. NyanGoodWill

    NyanGoodWill

    Joined:
    Sep 6, 2017
    Posts:
    10
    I used the model purchased from Unity Store (https://www.assetstore.unity3d.com/en/#!/content/22253)
    The model is the golfer swings the club.
    I am trying to hit the ball with the golf club.
    I did the followings.
    The ball was instantiated to have the same position as the club head at the beginning.
    Instantiate(Ball, m_CurrentHead.transform.position, m_CurrentHead.transform.rotation);

    I am expecting when the club come back to the ball, the two colliders collide so that I can start the ball flies.
    Now the problem is the two colliders never collide.

    Then I check the position of ball and head and the distances between them.
    The record is in the attached file.

    I found two problems looking at the data, please see in the attached file. The data is recorded in the update() function.
    (1)The initial position of the club head and ball are not close.
    (2)In the animation, the club swings left and right repeatedly so that I am expecting the club swings on the same path left and right, but now it is not.
    According to the data club's position hx,hy,hz are never on the same path and always increasing. Please see on the attached file.
    I recorded as
    distance position of ball position of club head
    dist 0.7269782 bx -0.4022511 by 0.4920379 bz 1.148459 hx 0.04074574 hy 0.1394261 hz 0.692481

    How can I make the two object collides?
    My another reason to look at the distance the two objects is when they are getting closer I will fly the ball.
    But I don't understand why the club swings is never on the same path.
    Many thanks in advance.
     

    Attached Files: