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 JediJerboa · Nov 20, 2020 at 10:58 AM · controllertimecamera movementcooldowncharge

How to create a charge attack?

I'm trying to create a charge attack similar to Reinhardt's Charge in Overwatch, but I'm not exactly sure on how I should go about it. The main things I'm having issues with is switching the cameras during the charge and how to set up a timer for the charge. Any other tips are extremely helpful.

Comment
Add comment · Show 1
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 Llama_w_2Ls · Nov 20, 2020 at 02:30 PM 0
Share

Could you explain why you need to switch cameras in the charge? I dont play Overwatch and im thinking about the Demoman's charge in TF2 instead. It would be more helpful if you could describe the exact charging effect youre trying to create. @JediJerboa

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by JediJerboa · Nov 20, 2020 at 08:42 PM

@Llama_w_2Ls In game, the camera zooms out to third person to allow for better steering. Essentially, the charge is just one rocket boost forward with a slower turning speed with no way to stop other than the charge time running out or you crash into a wall. You can also "pin" enemies, where they become stuck to the player model and it also does damage to them if you collide with a wall. I really just need to figure out a way to get a model to burst forward and have difficulty turning, thus when the third person camera comes into play.

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 Llama_w_2Ls · Nov 21, 2020 at 07:38 AM

If your character has a rigidbody character controller, you can addforce on its transform.forward direction, to create a burst-like charge attack. To have difficulty turning, you would simply need to lower the sensitivity of your camera control. Finally, for a third person camera, change its transform.position to be a bit higher on the y, and a bit back on the z, to make it look third person.


If the character is a rigidbody controller, it should automatically stop when hitting a wall. If (like in TF2) you would want the charge to be also stopped by swinging your sword/weapon in mid-charge, you can add a counter-force in the opposite direction of the player.


Hope it helps.


You may need to change the way your movement works, if it isnt rigidbody, or you would have to simulate its effects. @JediJerboa

Comment
Add comment · Show 4 · 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 JediJerboa · Nov 22, 2020 at 05:34 PM 0
Share

I see. However, the turning is also normally affected by the movement keys. I’ve had people suggest I do something with the angular velocity on the y-axis, but I’m not so sure how to write that in code.

avatar image Llama_w_2Ls JediJerboa · Nov 22, 2020 at 05:59 PM 0
Share

Oh right. If your character is rigidbody, you can access its velocity properties. If you increase the drag or the mass, adding the same force will be harder. However, the angular velocity is how fast the rigidbody can rotate. You can access it whilst charging by writing rigidbody.AngularVelocity im guessing, and set it to a new Vector3, where the y component is lower/higher so it is harder/easier to turn. I hope you figure it out.

avatar image JediJerboa Llama_w_2Ls · Nov 22, 2020 at 06:46 PM 0
Share

I got it. I decided to use rigidbody.AddRelativeForce instead, and it gives the desired effect. I moved onto the camera issue, where I tried using this to change the camera's position:

 GameObject.Find("$$anonymous$$ain Camera").transform.position = new Vector3(0f, 2f, -6.2f);

However, it seems to move the character along with it and not go into 3rd person (I'm guessing this has to do with the camera being a child of the player object) and I'm not sure how to toggle the camera's look sensitivity.

Show more comments

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

147 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 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 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 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 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 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 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 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 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 avatar image avatar image avatar image

Related Questions

Character controller without Deltatime 1 Answer

How to rotate camera diagonally over players shoulder while still facing towards players direction 0 Answers

Should I be using time.fixedDeltaTime here? 5 Answers

How to make a sound play and have a delay after so it can't be activated again very fast? 1 Answer

MMD How to export model and animations to Unity as 3rd person controller? 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