Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
-2
Question by united4life · Nov 23, 2012 at 09:17 AM · football

Goalkeeper movement.

I am making a simple soccer penalty shootout game. I am not able to do scripting for goalkeeper. Can anyone help me?

Comment
Add comment · Show 5
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image greatestprez · Nov 23, 2012 at 04:12 PM 0
Share

Pretty vague question, what exactly do you want? if you want the goalkeeper to simply move from side to side across the goal then you could use unity's animation editor or Vector3.Lerp().

avatar image Berenger · Nov 23, 2012 at 04:18 PM 0
Share

If you're looking for a character jumping one side or the other and catching the ball with his hands, we're far beyond "simple"

avatar image united4life · Nov 23, 2012 at 04:50 PM 0
Share

Now i am able to move the goalkeeper but how to reset his position. Whenever goal is scored or if he saves the goal then i want to reset his position to his initial position. How to do that?

avatar image greatestprez · Nov 23, 2012 at 05:34 PM 0
Share

Create a vector3 named initialPosition and assign its values to the xyz position you want to return to, then, when you want your goalkeeper to return to initial position say that goalkeeper.transform.position = initialPosition and you're good to go! if you want the goalkeeper to move smoothly back to its initial position then you could use vector3.Lerp().

avatar image united4life · Nov 23, 2012 at 07:40 PM 0
Share

That didnt work. But i did something else and its working. Thanks for the help though.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by united4life · Nov 23, 2012 at 08:02 PM

Now i am able to move the goalkeeper but how to reset his position. Whenever goal is scored or if he saves the goal then i want to reset his position to his initial position. Ho to do that?

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image abdulthegamer · Jun 05, 2014 at 11:55 AM 0
Share

Can you please provide the code how you did that so others can also gain some knowledge regarding that... Thanks in Advance.

avatar image
0

Answer by Karsnen_2 · Nov 23, 2012 at 08:35 PM

  • Have a position near the center of the D box as the default position for the GK.

  • When the ball enter the your half of the field, create a switch between "Opponent Possession" & "Your Possession".

  • Lets first talk about "Opponent Possession". Always LookAt the ball. Create a percentage of the ball from you towards the half line.

  • Depending upon this percentage position the GK towards the ball. Also Calculate the percentage of the ball on the width of the pitch. WIth this percentage, position the GK within the width of the GK area.

  • When the ball is less than certain distance from the GK, make a run for the ball.

  • If the ball is less than certain distance (min) from the GK, allow the GK to snatch the ball 8 out of 10 times. (Value of the Player).

  • Considering the case of "Your Possession", at times when you have to snatch the ball the player actually has to kick the ball.

I hope this helps to start!!!

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

16 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

football script 1 Answer

Football goal script 1 Answer

flick football asset purchased from unity asset store ... 0 Answers

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

More realistically interaction with soccer ball 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges