• 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 imanik · Jun 23, 2015 at 12:47 PM · movementphysicsvelocity

How to move a gameObj by cicking/ touching another gameobj?

I want to move a gameobj(car) by touching or clicking another gameobj(cube) so how could I?

  1. my car go have rigidbody attached

  2. car obj can move by keyboard input (but I want that now with touch/click)

  3. car obj move by velocity -- (keybrd move ex):( m = input.GetAxis("vertical") ..vel = m*speed)

  4. cube go has also attached a script -- (long press(){//on long press cube move on z axis })

  5. cube has no rigidbody attached

EG: 1. My script is javacript; 2. Velocity is more preferable then translate (for smooth movement)

Comment
Add comment · Show 5
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 Johnz1234 · Jun 23, 2015 at 06:33 PM 0
Share

you want to drag your object or you want you object to move when you click like button or moving to position , like in clash of clans

avatar image imanik · Jun 24, 2015 at 05:25 AM 0
Share

No i just want to use my cube as a direction button so I want to control my car with that button any Idea about that

avatar image Neilos · Jun 24, 2015 at 05:41 AM 0
Share

What happens when you touch the cube? Does the car always accelerate and that is it? Or would you like the cube to give the car a direction (sort of like a joystick)?

avatar image imanik · Jun 28, 2015 at 04:47 AM 0
Share

I wanna give the car a direction with that button

avatar image yoda12 · Jun 28, 2015 at 05:11 AM 0
Share

Wait, are you asking for how to make a car go to a "checkpoint"? That would require path finding.

0 Replies

· Add your reply
  • Sort: 

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Constraining maximum movement speed on a rigidbody on certain axes. 1 Answer

Detecting when my character is not moving? 1 Answer

Need help with my movement script.. :( 1 Answer

(RigidBody) Velocity at an Angle 0 Answers

How can I make 2D movement less jerky on a controller, with velocity and such? 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