Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
This question was closed May 22, 2016 at 12:22 PM by n_armelle for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by n_armelle · May 15, 2016 at 09:05 AM · movementplayermaxmagnitude

Calculate max velocity.magnitude

Hello guys, first of all, sorry if i made mistakes, english is not my native language, so if you don't understand tell me, i will try to re-explain it :)

I try to calculate the maximum speed of my player, in the purpose to deal damage when he collides with another object, according to a percentage equal to : (his current speed/maximum speed).

To have the speed, i think to use velocity.magnitude, but i didn't find how to calculate the maximum magnitude of my player.

My player have a rigidbody, with a mass of 50 and a drag of 3. To make my player move, i use Input.GetAxis(X) and Input.GetAxis(Y) i put them in a Vector3 name movement, then i make myPlayerRigidbody.AddForce(movement x Speed, forceMode.Force)

Speed is a public int, currently set to 2500.

Thanks for your help, i already look at a lot of topic yesterday for many hours, and i didn't find a working manner to do what i want.

Comment
Add comment · Show 4
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 n_armelle · May 20, 2016 at 04:25 PM 0
Share

I still need help please ^^

avatar image FortisVenaliter · May 20, 2016 at 04:28 PM 1
Share

So, what is the question? You want to deter$$anonymous$$e the maximum speed?

If so, usually, you'll just pick an arbitrary number. But if you want to measure it, I would just print out the velocity.magnitude every frame, get up to speed in the game, and see what is printed.

avatar image n_armelle FortisVenaliter · May 20, 2016 at 04:39 PM 0
Share

Yes i want to deter$$anonymous$$e the maximum speed, but with calculation, because if i change drag of mass of my player it will change the max speed

avatar image FortisVenaliter n_armelle · May 20, 2016 at 05:29 PM 0
Share

Then you're going to need to run the physics calculations yourself, after quite a bit of research.

Alternately, you can just use flat limits, rather than as a percentage of speed; in which case you don't need to know the absolute maximum.

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

64 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

Related Questions

Change Camera's size relative to player's speed 0 Answers

Top Down Character - Face direction of movement? 0 Answers

Object Player Movement stops working after Restarting Unity 0 Answers

How to move 3 players at the same time in V form,How to move 3 characters in the same time in V form 0 Answers

Character continues moving when locked onto an enemy 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