HI
i am making a golf game and currently facing some problems with the physics of the ball.
var target : Transform;
var speed : float;
var force : float;
var angle = 50;
function FixedUpdate()
{
if (target == null GameObject.FindWithTag("hole"))
target = GameObject.FindWithTag("hole").transform;
if(Input.GetButtonDown("Jump"))
{
print("HIT");
Hit();
}
}
function Hit()
{
var torque = Vector3(Input.GetAxis("Vertical"), 0, -Input.GetAxis("Horizontal"));
var targetRotation = Quaternion.LookRotation (target.position-transform.position,Vector3.forward);
transform.rotation = Quaternion.Slerp(transform.rotation,targetRotation,8);
transform.eulerAngles.x = -angle;
rigidbody.AddTorque(torque.normalized*speed);
rigidbody.AddForceAtPosition (transform.forward * speed * force,target.position, ForceMode.VelocityChange );
}
the effect i am currently getting is something like this
and what i actually want would be like this
i have attached a rigid body to the ball and the rigid body properties are
mass 45
drag 0.5
annual drag 2
gravity true
is kinematic false
interpolate none
freeze rotation false
collision detection continuous
the problem i am facing is that once after hitting when the ball collides with the ground it bounces at the same position(the bounce reduces at every contact with the ground) and doesn’t move forward but actually what should happen is that the ball should move forward and the bounce should keep reducing on each collision with the ground
can anyone please help me out with this problem
thanks in advance

