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 Brum · Oct 08, 2013 at 10:53 AM · c#mathformula

Math question

Hello,

I've stumbled upon a question which I cannot answer with my basic high-school math skills. I've got this line of code:

    alertOMeter = Mathf.Lerp(alertOMeter, 100,2f*Time.deltaTime);

but now i want to increase the "Acceleration" when a certain float gets smaller:

 float distanceToPlayer = Vector3.Distance(transform.position, _player.transform.position);

It would be great if someone could help me with this!

Brum.

Comment
Add comment · Show 2
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 mattssonon · Oct 08, 2013 at 11:23 AM 0
Share

What is alertO$$anonymous$$eter supposed to be doing? What's its purpose?

avatar image Brum · Oct 08, 2013 at 11:51 AM 0
Share

I think it's not really relevant for answering the question, but if you want to know. Its purpose is that when the meter is at 98 or more the enemy has realy spotted you. at the same time the color of the exclamation mark above its head changes:

 exclm.renderer.material.SetColor("_TintColor",Color.Lerp(exclm.renderer.material.GetColor("_TintColor"),Color.yellow,2f*Time.deltaTime));

here you see it uses the same increasing method. so whatever anyone will come up with, i'll use it there as well.

I hope this was enough?

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by GEWLAR · Oct 08, 2013 at 12:45 PM

You can dividend 1 by the float. I mean x=1/distanceToPlayer On this way your result gets bigger when the float gets smaller. Hope you understand what I mean. Sorry I'm not a native speaker.

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 Brum · Oct 08, 2013 at 01:15 PM 0
Share

Thank's man! i get what you meant, although I really had to crank up the "1" to get the effect I wanted. I'm also not a native speaker ;)

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

17 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

Related Questions

Distribute terrain in zones 3 Answers

Trouble with Basic Math Formula for Deriving Velocity 1 Answer

Multiple Cars not working 1 Answer

How to detect if number has a decimal point or not 2 Answers

Minimap rotating nodes 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