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 mhailin · Jan 11, 2014 at 05:53 AM · forcetap

how to put upward force using tap

hello..

iam new to unity and i just want to ask you about tapping,that if you tap the button the object will goes upward and then if i want to stop tapping the button it will go back to its original position...

we are trying toimplement a game just like water toss that you need to shoot the ring in the pole dat once you tap the ring it applied upward force inorder to shoot the ring to the pole..

i hope you can read this message asap.. we nid ur helppp.... thank you so muuuuch

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
0
Best Answer

Answer by lexen1 · Jan 11, 2014 at 04:59 PM

I had that problem just a couple of minutes ago. I solved it by adding:

     if (Input.GetButtonDown ("Jump")) {
         rigidbody.AddRelativeForce (Vector3.up  * 1000);
     }

to the void Update. That said, I am going about this in a strange way because of the way my game works.

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 Josenifftodd · Jan 11, 2014 at 06:52 AM

This might work not sure, I've just made my Mill (Blades) start rotating. This should make your camera rotate, use this to start working out which way it needs to rotate if you understand how Vector3 works. I'm not sure how to make it reset back to its set position you will have to work that one out I'm a nooob at coding.

 var button: GameObject; // Attach a GUI.Tecture here
 var camera: GameObject; // Attach your Camera Here in your inspector
 var speed: int; // Speed of the camera moving upwards
 
     var btnTexture : Texture;
     function OnGUI() {
         if (!btnTexture) {
             Debug.LogError("Please assign a texture on the inspector");
             return;
         }
         if (GUI.Button(btnTexture))
                 camera.transform.Rotate(-Vector3.forward * speed * Time.deltaTime);
                 Debug.Log("Clicked the button with an image");
         else {
             Debug.Log("You need to attach a reset script here. Not sure how to do this myself.")
     }
Comment
Add comment · Show 2 · 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 mhailin · Jan 11, 2014 at 07:06 AM 0
Share

thank you so much. it can help us..

do we need to create a button wherin every time we tap that button the ring will float towards the pole? beacause our game is purely underwater,the environment is underwater sir.

avatar image Josenifftodd · Jan 11, 2014 at 04:53 PM 0
Share

I'm not too sure about that I only really know how to make it rotate

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

20 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

Related Questions

How to make an object go upward when button is click 1 Answer

Apply force at an angle or transform.rotation 1 Answer

Melee attacking, using force and health values 1 Answer

stop adding force 2 Answers

How can I apply force in the direction of the camera when the user presses the mouse 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