I am at an impasse. I can touch an object with my finger and it will follow the movement. What I then want is for the object to continue in a decaying arch once I have picked up my finger. I have all of my touch controls in the FinalUpdate function. Any help would be appreciated.
Answer by StephanK
Mar 19, 2010 at 09:43 AM
If your object is a rigidbody you could add a force to it that is proportional to your finger's movement speed before you release the object.
If it's not a rigidbody you could implement a kind of smoothing for the acceleration of the object.
On release start a coroutine that interpolates you movement speed between last known speed and 0 over a given time.
I think there could be a better method to this problem. I have a ray going from the mainCamera to the object and I have noticed that this ray will point in the direction that I want. So I can take the ray's direction and notice that the x value is negative then throw left. If the ray's direction has a x value of positive, the I know it should throw right.
Answer by revelopment
Jun 21, 2011 at 01:09 AM
This tutorial has an interesting inertia code after dragging and rotating an object, you might find it useful.
source code is here:
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
1 Person is following this question.
The name 'Joystick' does not denote a valid type ('not found')
Block UnityGUI Hit
Infinite swing with SpringJoint
Dynamic water Effects
RigidBody Physics Flight Simulator Script Help