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
0
Question by WalidMohamed · Aug 13, 2016 at 05:42 PM · unity 5objectjumpbounce

how to make give a cube the capability to make an object jump when it comes on it ??

i wanna make the player which is a ball jump when it touches particular cubes ,but not using bouncing because it doesn't give the same value of jump every time and thanks

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by BloodBTF · Aug 13, 2016 at 07:03 PM

You could try

1.making a custom tag for the cube that allows you to jump and call it something like "Jumpable"

2.make a script, or edit your player script and add this.

 public float jumpPower = 5f;
 bool hit;
 public Rigidbody rb;
 void Start()
 {
  rb = GetComponent<Rigidbody>();
   //or just assign the rigidbody yourself
   }
 void OnCollisionEnter(Collision col)
 {
 if (col.transform.tag == "Jumpable")
 hit = true;
 }

 void OnCollisionExit(Collision col)
 {
 if (col.transform.tag == "Jumpable")
 hit = false;
 }
 
 void Update()
 {
 if (hit)
 {
 rb.AddForce(0f,jumpPower,0f,ForceMode.Accelaration);
 }
 }



THEN:

Assign this script to your player's COLLIDER, not the OBJECT ITSELF. be sure to assign the players rigidbody in the inspector to the script

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 WalidMohamed · Aug 16, 2016 at 12:54 AM 0
Share

thanks for your help , but it didn't actually work

avatar image danivdwerf WalidMohamed · Aug 16, 2016 at 01:15 AM 0
Share

Does the object that needs to jump an rigidbody AND does the object it needs to touch have a collider?

avatar image WalidMohamed danivdwerf · Aug 21, 2016 at 03:11 PM 0
Share

yes Look i want to make the ball jumps when it hits the cube but that's by the cube power not it's

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

How to make objects "Bounceable" 1 Answer

how the ball bounces of equal in angles? 1 Answer

How to add a Object Reference 1 Answer

Sonic trampoline style with character controller(old one) 1 Answer

Saving Object Name in a database when it is clicked ? 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