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
0
Question by Foxmonkey104 · Aug 22, 2012 at 08:40 PM · movementthird-personattackstop

How to halt all other movement during an attack

I currently have a third person game in which my character can successfully run, jump, sprint and attack. It is an edit of the 3rd person controller script altered to accommodate a simple kick animation when the left mouse button is clicked. The issue is, the kick is meant to be performed while standing still, so if i am moving at all when i decide to kick, the character appears to slide across the ground. Is there any way for me to halt all directional movement for when the character is kicking? If so, can that same principle be used to make it so that the character cannot kick when he is in mid-air?

Any help is much appreciated.

-Foxmonkey104

Comment
Add comment
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

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Panik.Studios · Aug 22, 2012 at 09:15 PM

I think you need to add constraints... Im not sure how to do this.. I tired looking in the referencesm but perhaps you could do something like

 function Update(){
 
     if Input.GetAxisRaw("kick"){
 
        Input.GetAxisRaw("Horizontal") =     false;
 
        Input.GetAxisRaw("Vertical") = false;
 
     }
 
     else {
                   Input.GetAxisRaw("Horizontal") =     true;
 
        Input.GetAxisRaw("Vertical") = true;
 }
 }
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
avatar image
0

Answer by Mander · Aug 22, 2012 at 09:12 PM

yes u can stop ur char from moving. u can make a bool and

 if(kickin){
 //stop ur movement
 animation.Play("kick");
 
 }

or u can place ur movement controllers inside the kicking if

 if(!kickin){
 
     //movement controllers
     }else if(isGrounded && input.GetButtonDown("Fire1"))
     {
     kickin= true;
     animation.Play("kick");
     kickin= false;
     }

if u r using character controller. you can make an if statement using isGrounded this way u can kick only if u r on the ground.

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 Panik.Studios · Aug 23, 2012 at 01:18 AM 0
Share

How does this solve the character moving though? All this does is telling is to play the kick animation when kicking.. Fox said the kick executes but the character slides.. Not saying this code you've given wont do that, but how is it doing that?

avatar image
0

Answer by behzad.robot · Aug 23, 2012 at 05:27 AM

I think This may Help You Stoping Character I've used it for my own script which was not edited version of 3rd Person Controller And the guy was a runner And it answered The character Stops !!

if(Input.GetAxisRaw("kick"))

{

motor.inputMoveDirection = Vector3(0,0,0); //Your Code Here

}

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 behzad.robot · Aug 23, 2012 at 03:05 AM 0
Share

I think This may Help You Stoping Character I've used it for my own script which was not edited version of 3rd Person Controller And the guy was a runner And it answered!! I've Also given this as an answer but i dont have enough karma So it wont be showed to public till a moderator accepts it :(

if(Input.GetAxisRaw("kick"))

{

motor.input$$anonymous$$oveDirection = Vector3(0,0,0);

}

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

10 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

Related Questions

Stop moving GameObject 1 Answer

how to make the character stops temporarily in the start 1 Answer

Joystick direction To Camera direction Help!!!XD 1 Answer

How to prevent movement in a specific direction only? -1 Answers

2D UFO Tutorial - Stop the Ship 1 Answer


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