x


I am having a problem with momentum of an object after releasing a touch from the iPhone.

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.

more ▼

asked Mar 19, 2010 at 01:33 AM

Ed gravatar image

Ed
22 24 16 26

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

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.

more ▼

answered Mar 19, 2010 at 09:43 AM

StephanK gravatar image

StephanK
6.5k 117 106 160

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.

Mar 19, 2010 at 06:42 PM Ed
(comments are locked)
10|3000 characters needed characters left

This tutorial has an interesting inertia code after dragging and rotating an object, you might find it useful.

http://www.youtube.com/watch?v=oOfPMKdJdKk

source code is here:

http://www.revelopment.co.uk/tutorials/unitytutorials/73-howtorotateanobjectbytouch

more ▼

answered Jun 21, 2011 at 01:09 AM

revelopment gravatar image

revelopment
91 4 3 4

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

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

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x9390
x3231
x2231
x32

asked: Mar 19, 2010 at 01:33 AM

Seen: 1886 times

Last Updated: Jun 21, 2011 at 01:09 AM