• 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 $$anonymous$$s position. Whenever goal is scored or if he saves the goal then i want to reset $$anonymous$$s position to $$anonymous$$s 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 t$$anonymous$$s percentage position the GK towards the ball. Also Calculate the percentage of the ball on the width of the pitch. WIth t$$anonymous$$s percentage, position the GK wit$$anonymous$$n 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 t$$anonymous$$s 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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

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

what value should i change to get football from material 1 Answer

Trying to make a ball move like "haxball" 0 Answers

How do I create a soccer penalty shootout in Unity 3D? 2 Answers

kick a ball 2 Answers

Goalkeeper AI 2 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