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 /
avatar image
1
Question by PatD17th · Nov 18, 2017 at 10:19 PM · jumpspeedpowerupboost

Power Up speed and jump boost

So I have that problem when I do know how to make those collectibles but I do have problem with power ups. What should I do when I want to make two power ups that make player move faster for couple of seconds and another booster is for thrusting player in the air. What should I start with?

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

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by $$anonymous$$ · Nov 19, 2017 at 04:28 AM

I did this a while ago, and here's what I used:

Jump Boost:

  1. Create and tag your Power-Up: "JumpBoost"

  2. Make Sure that it's collider is checked "IsTrigger"

  3. Add this Script to your Player! (It's in JavaScript, I hope that's okay)


    var JumpForce : float = 500; //The Jump Height!

    var rb : Rigidbody; //This will be grabbed Automatically!

    function OnTriggerEnter (other : Collider)

    { if (other.gameObject.tag == "JumpBoost") //If the Player Touches the Power-Up...

      {
     
             rb.AddForce (Vector3.up * JumpForce); //JUMP!!
     
         }
     
     }
     
     function Update ()
     
     {
         
     rb = GetComponent(Rigidbody);
     
     }
    
    

Keep in mind this script will boost your Player as soon as they touch it. Adding some kind of "power-up holder" is a little more complex, but is still possible.

Speed Boost:

I don't have a script for this one, but use the "OnTriggerEnter" function in your Player Movement Script to allow the player to interact with the power-up. Instead of the power-up adding force up, make it increase the Move Speed, and set a timer using Invoke ("Function Name", time);


Example:

 function OnTriggerEnter (other : Collider) {
 if (other.gameObject.tag == "SpeedBoost")
 {
 MoveSpeed = 10;
 Invoke ("RegularSpeed", 5);
 }
 
 function RegularSpeed ()
 {
 MoveSpeed = 5;
 }

Hope this Helped!!

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 PatD17th · Nov 19, 2017 at 01:02 PM

Will this work in C#? What should I put in void Start and what in void Update?

Comment
Add comment · Show 3 · 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 $$anonymous$$ · Nov 19, 2017 at 03:18 PM 1
Share

This won't work in C#, but it will if you replace function with void and replace the variables from var JumpForce : float; to public float Jumpforce; and public Rigidbody rb; There's also a Js to C# converter that can really help with these kinds of things! You don't need anything in Start and Update, but you can put the "rb = GetComponent(Rigidbody);" in the Update void to find the rigidbody automatically.

avatar image PatD17th · Nov 19, 2017 at 06:02 PM 0
Share

Thanks! Everything is working! You saved me.

avatar image $$anonymous$$ PatD17th · Nov 19, 2017 at 07:07 PM 0
Share

No Problem! :D

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

72 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

Related Questions

Increase speed of object that enters OnTriggerEnter 1 Answer

Increasing the speed for a few seconds doesn't work. 1 Answer

HELP! With my Speed power up 2 Answers

Increase the speed after collision 0 Answers

Player movement problem 0 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