# playMaker

### Author Topic: Move Towards - Negative Finish distance  (Read 2351 times)

#### VascBogdan

• Full Member
• Posts: 118
##### Move Towards - Negative Finish distance
« on: January 22, 2015, 04:25:49 AM »
I have a Move Towards action, and I need it to actually surpass the destination point. I need it for a 2D game, for a bullet. The Finish Distance is what I need, but a negative value, not a positive one. How can I make this possible ?

#### Lane

• Hero Member
• Posts: 2487
• Yup.
##### Re: Move Towards - Negative Finish distance
« Reply #1 on: January 22, 2015, 05:10:45 AM »
Move Towards needs a destination so after you reach it you need to switch to something else for continuing motion if thats what you want.

You could use Translate on the Z axis with the current velocity of the bullet in Self space after it reaches the target, or use Translate to begin with so you dont have to do any transition.

#### VascBogdan

• Full Member
• Posts: 118
##### Re: Move Towards - Negative Finish distance
« Reply #2 on: January 22, 2015, 08:02:42 AM »
Ok. I got my Translate into the state, I took the bullet Z from it (I mention that the bullet will be created before moving, with Create Game Object) and now what ?

#### Lane

• Hero Member
• Posts: 2487
• Yup.
##### Re: Move Towards - Negative Finish distance
« Reply #3 on: January 22, 2015, 08:11:00 AM »
You need the direction and speed for Translate. Since its already pointing in the right direction you just need to put the speed in the Z Self axis of Translate.

Normally this is basically done immediately when the bullet is instantiated so unless you're using Move Towards for some specific reason you should probably just create the bullet and use Translate right off the bat.

You'll find this tutorial useful, it goes over these basic ideas.

#### VascBogdan

• Full Member
• Posts: 118
##### Re: Move Towards - Negative Finish distance
« Reply #4 on: January 22, 2015, 09:56:59 AM »
I viewed the tutorial and tried to apply an Impulse force for an axis (Add Force action) to my bullet prefab. The problem is not that the bullet go to it's target position, and then he change the direction to the right part. So, if I target it to go down, it will go down until it's final position, and then it will turn right. The force effect looks OK, but only if I can solve it.
Any ideea ?

#### Lane

• Hero Member
• Posts: 2487
• Yup.
##### Re: Move Towards - Negative Finish distance
« Reply #5 on: January 22, 2015, 10:11:18 AM »
It sounds like Move Towards is only causing you problems. I recommend removing it and using the method that the video tutorial uses.

#### VascBogdan

• Full Member
• Posts: 118
##### Re: Move Towards - Negative Finish distance
« Reply #6 on: January 23, 2015, 07:35:06 AM »
But the tutorial uses Add Force, and I need a direction (from Mouse Pick).

#### VascBogdan

• Full Member
• Posts: 118
##### Re: Move Towards - Negative Finish distance
« Reply #7 on: January 23, 2015, 03:40:09 PM »
Still didn't solve it. Sorry for bumping. I replied again and I explained what I tried, but I my post just got deleted, or maybe not even posted. I tried some Force combinations, iTween Move To but I didn't get what I need. I agree about replacing the move towards, but how ? I get a destination from a Mouse Pick action. Should I add an equal value to both X and Y values of the destination ?

#### VascBogdan

• Full Member
• Posts: 118
##### Re: Move Towards - Negative Finish distance
« Reply #8 on: January 24, 2015, 07:54:03 AM »
I tried to add a float value to both X and Y values, created another Vector 3 and put it as a destination for MoveTowards. Didn't work.

Can someone help me with this, please ?

#### VascBogdan

• Full Member
• Posts: 118
##### Re: Move Towards - Negative Finish distance
« Reply #9 on: January 25, 2015, 06:34:39 AM »
Bump!

#### VascBogdan

• Full Member
• Posts: 118
##### Re: Move Towards - Negative Finish distance
« Reply #10 on: January 26, 2015, 12:42:30 PM »
Bump!