How to drag 2D Rigidbody using velocity in Unity?

First of all, let me say that I'm just starting with Unity, so apologizes in advance if I'm asking silly questions.

I want to create a simple mobile 2D game where the user will be able to drag a circle object (player) with his finger (or with mouse on desktop) to move it around and hit another small circle (ball).

So currently I have the player object with Rigidbody set and Circle Collider set. I also have the ball with Rigidbody, Circle Collider with bounce material (from standard assets). For both gravity = 0.

What I need to do is to add that drag controller... I have no idea how to do that though. I've researched for few hours already and only find solutions using transform position, which doesn't work in my case (does it?) since I want to collide with the ball using the speed of the mouse/finger.

Does that make sense? Any suggestions?



Why did you remove the previous question? I still think transform.position is the way to go, you just need to calculate the ball speed based on the mouse speed. I think you're avoiding the real issue which is reading about and understanding vectors. It's ok that you're new to Unity, I am too, but please try and comprehend the importance of basic linear algebra concepts :)

Category: unity Time: 2016-07-29 Views: 1

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development


Front-end development


development tools

Open Platform

Javascript development

.NET development

cloud computing


Copyright (C), All Rights Reserved.

processed in 0.116 (s). 12 q(s)