- Home /
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?
my car go have rigidbody attached
car obj can move by keyboard input (but I want that now with touch/click)
car obj move by velocity -- (keybrd move ex):( m = input.GetAxis("vertical") ..vel = m*speed)
cube go has also attached a script -- (long press(){//on long press cube move on z axis })
cube has no rigidbody attached
EG: 1. My script is javacript; 2. Velocity is more preferable then translate (for smooth movement)
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
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
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)?
Wait, are you asking for how to make a car go to a "checkpoint"? That would require path finding.
Your answer
Follow this Question
Related Questions
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
How do I check for movement? 1 Answer
Smooth Player Ball Rolling 1 Answer