x


script to add force to the ball in a football game!

i am working on a game football and i am writing a script to add force to the ball when user kicks it..

when player kick the ball the ball should go in the specific direction with the velocity relevant to the force of player's kick..!

help me with this to write the script.. i have script written but it contains errors and it is very long to put here so please help me to solve this...

Thanks !

more ▼

asked Jun 21 '12 at 02:27 PM

Hims gravatar image

Hims
50 3 11 19

Have you tried setting the ball.rigidbody.velocity = kickForce?

Jun 21 '12 at 03:23 PM Loius
(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

thanks for the answer , if u haven't understand the question then the question is when the player kick the ball the ball should go in the direction in which the player had kicked it and with the force that the player applied to it while kicking the ball..!!

more ▼

answered Jun 22 '12 at 09:57 AM

Hims gravatar image

Hims
50 3 11 19

(comments are locked)
10|3000 characters needed characters left

one way to do it is using the physics engine: rigidbodies + colliders + physics materials (bouncy).

then you can use all the physics parameters & functions to do add the force to specific direction

unless I didnt understand the question correctly

more ▼

answered Jun 21 '12 at 04:09 PM

SolidSnake gravatar image

SolidSnake
449 4 6 8

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x330
x296
x11
x6

asked: Jun 21 '12 at 02:27 PM

Seen: 687 times

Last Updated: Jun 22 '12 at 09:57 AM