Playmaker Forum

Playmaker Updates & Downloads => Share New Actions => Topic started by: jeanfabre on June 04, 2012, 08:05:43 AM

Title: Itween move to with exisiting paths
Post by: jeanfabre on June 04, 2012, 08:05:43 AM
Hi,

 Following a post (http://hutonggames.com/playmakerforum/index.php?topic=1678.0 (http://hutonggames.com/playmakerforum/index.php?topic=1678.0)), please find a modified version of iTween move to that accept the path name of any iTween path you have in your scene. you don't need to build it within the action anymore.

 It's called iTween Move to V2 to not conflict with the original one.

Get it from the Ecosystem (http://j.mp/PlayMakerEcosystem)

(http://i.imgur.com/TOYvHX6.png)

you can download the iTween path visual editor here:

http://pixelplacement.com/2010/12/03/visual-editor-for-itween-motion-paths/ (http://pixelplacement.com/2010/12/03/visual-editor-for-itween-motion-paths/)

create a path with that extension, give it a name and plug that name in the "path name" field of iTweenMoveTo_V2  and done.


 bye,

 Jean
Title: Re: Itween move to with exisiting paths
Post by: rojosedano on June 11, 2012, 07:15:40 PM
Hi, I can not make an object look in the direction of the path. I put the action ITween move to v2.
The object always looks to the last node in the path.
as is done? I'm doing wrong?

 ???thanks
Title: Re: Itween move to with exisiting paths
Post by: jeanfabre on June 12, 2012, 12:08:28 AM
Hi,

 You need to set the "lookAhead" property to something like "0.01" and it will follow the path, else it does look at the end of the path yes.

Bye,

 Jean
Title: Re: Itween move to with exisiting paths
Post by: FlapFail on July 04, 2012, 01:10:22 PM
I'm sorry, but I am following your download URL now 10 times, it's like a circle :D
Am I stupid or why do I not find any download link to this custom action "iTween Move To V2" ??
Title: Re: Itween move to with exisiting paths
Post by: jeanfabre on July 05, 2012, 12:12:33 AM
Hi,

 it's in the very first post of this thread as an attachment, I made a quick link below:

http://hutonggames.com/playmakerforum/index.php?action=dlattach;topic=1699.0;attach=975 (http://hutonggames.com/playmakerforum/index.php?action=dlattach;topic=1699.0;attach=975)

Bye,

 Jean
Title: Re: Itween move to with exisiting paths
Post by: FlapFail on July 09, 2012, 01:35:36 AM
omg, I looked at this post maybe 5 times and did not see the attachment :D

Thanks!
Title: Re: Itween move to with exisiting paths
Post by: tnaseem on August 25, 2012, 05:22:37 PM
Just a heads up that the reverse path mode in this action doesn't work. In my version I replaced the line:

Code: [Select]
hash.Add("path", iTweenPath.GetPath(pathName.Value)) ;

with a check for the 'reverse' checkbox, and use the iTweenPath.GetPathReversed() function for the reverse path mode:

Code: [Select]
if(reverse.Value)
hash.Add("path", iTweenPath.GetPathReversed(pathName.Value)) ;
else
hash.Add("path", iTweenPath.GetPath(pathName.Value)) ;

You might want to update the action in the link above with these changes.

Cheers,
Tarique.
Title: Re: Itween move to with exisiting paths
Post by: jeanfabre on August 28, 2012, 12:17:17 AM
Hi,

 Thanks, I updated the download link.

 bye,

 Jean
Title: Re: Itween move to with exisiting paths
Post by: memetic arts on March 18, 2013, 04:18:24 AM
Hello -

Just now getting my feet wet with PlayMaker, and have high hopes. . . though still not sure if I'm going about things correctly.

I'm generating a spline with 8 randomly set points, using Vectrosity, and have put that script on an empty game object (named "randSpline"), to which I've also added an FSM.  I'm using 'Send Message' to trigger a 'ready' state once the spline (named "Spline", go figure) has been created.  From there I want to move another object (named "Circle") along the spline, also generated using Vectrosity.

In my first attempt, I added the iTweenMoveTo_v2 action to randSpline, changing the value of GameObject to "Circle", and Path Name to "Spline".  That didn't work . . .

I made a similar attempt by adding an FSM to the Circle object itself, but can't seem to get it to recognize the path by its path name . . . do I need to reference the spline generation script aht is attached to the randSpline object?  Just not sure how much needs to specified and how much is "known" within the PlayMaker context.

Any/all help would be greatly appreciated!

Thanks!

==rr
Title: Re: Itween move to with exisiting paths
Post by: jeanfabre on March 18, 2013, 05:48:27 AM
Hi,

 iTween move to only works with path generated WITH iTween.

http://pixelplacement.com/2010/12/03/visual-editor-for-itween-motion-paths/

bye,

 Jean
Title: Re: Itween move to with exisiting paths
Post by: memetic arts on March 18, 2013, 06:52:17 AM
Aha!  Well, that's good to know.  I'll definitely try it with iTween "native".

Would you see any issues with maybe just passing the Vector3D array that defines the spline in my Vectrosity script to the Path Nodes parameter of the MoveTo_v2 action?

Many thanks for the very fast reply, really appreciate that!
Title: Re: Itween move to with exisiting paths
Post by: jeanfabre on March 18, 2013, 06:53:45 AM
Hi,

 no, that should totally feasible, but you'll need some scripting to do this, cause playmaker doesn't really offer this kind of data handling by default.

 Are you comfortable with scripting?

bye,

 Jean
Title: Re: Itween move to with exisiting paths
Post by: memetic arts on March 18, 2013, 07:21:35 AM
Yes, I'm a decent scripter.  I think my true question now is more around PlayMaker architecture . . . right now I have an FSM on the object that's acting as the spline generator.  When the spline has been drawn, the script is firing a "ready" value through a boolean variable and triggers the listener:

if(ready){
   myListener.Fsm.Event("ready");
}

I've got that wired to another state which has the MoveTo_v2 action on it, and am referencing "Circle" as the GameObj.  If I'm planning on having a bunch of these circles animating on the same spline, with independent speeds and easing values, I'm thinking it makes more sense to put the moveTo action on the circle obj rather than on the listener . . . but if I do that, I'm not sure how I'd grab the vector array. 

On the other hand, if I keep it all on the listener, then I could just have a separate state for each circle, I suppose . ..  just not sure which is more efficient, and if it will bite me later on as this app grows . . .

Many thanks for the assist here, really appreciate it!
Title: Re: Itween move to with exisiting paths
Post by: jeanfabre on March 18, 2013, 10:28:38 PM
Hi,

 Very good :)

don't hesitate to download the various port I did on the wiki, I am not saying they are the best and bullet proof examples, but that will surely give you some directions to explore and build up some expertize on that matter. If you master communication between playmaker and scripts, you will really build powerful stuff.


don't hesitate ot offload work on the gameObjects themselves, and keep the listener to a bear minimum, I find this to be the most flexible approach. the listener job is to listen and dispatch, not to care about what other objects will do with that call.

bye,

 Jean
Title: Re: Itween move to with exisiting paths
Post by: memetic arts on March 19, 2013, 06:28:08 AM
Thanks very much, Jean, I'll definitely have a look at the wiki, and hopefully it will get me going in the right direction.  Right now I feel like I'm still shooting in the dark, as I'm not sure how to assign the Vector3 data to the individual Node x y z values . . . feels like a loop and some parsing might be in order, but am going to have a look at your work first.

Cheers,

=rr
Title: Re: Itween move to with exisiting paths
Post by: memetic arts on March 19, 2013, 11:20:48 AM
Just to follow up, I was successful in the initial effort here, of generating a non-iTween spline with randomly-assigned x/y/z  values (using Vectrosity) and moving an iTween-controlled object along it.

The breakthrough moment came when I figured out how FSM variables work, and how to assign them via script. (that's how green I am!)

Much more to do, of course, but happy to be making progress.  Thanks to Jean for the quick, informative replies and encouragement!

Now on to dynamically creating variables . . . hmmmmmmm . . .
Title: Re: Itween move to with exisiting paths
Post by: jeanfabre on March 19, 2013, 11:54:15 PM
Hi,

 Why do you want to create variables dynamically? you mean Fsm variables right? I never had to do this, so likely, you may have other solutions.

Fsm variables exists only for the user to create his fsm, once you are in your scripts, be it an custom action script, you can use normal variables. Fsm variable are only needed to help Playmaker bind everything visually.

bye,

Jean
Title: Re: Itween move to with exisiting paths
Post by: memetic arts on March 20, 2013, 03:47:19 AM
Actually, someone in another section of the forum asked a similar question, so I glommed-on, and Alex provided the info -- it's actually pretty easy, just a matter of knowing the syntax (as it usually is when learning new tools!).  But yes, FSM variables (in the "Variables" tab).

You may be right about scripting, and this solution of using variables is most likely a "stepping stone" so as not to impede my progress with actually finishing my app.  It was the only way I could figure to get the data in and make it available the iTween MoveTo action for defining a path.  But since you asked, I explain.   :)

I've currently hardcoded a set of six variables on the FSM to act as containers for the set of six Vector3 coordinates that I'm using to set up my spline, following the techique described here (in the second code block):

http://hutonggames.com/playmakerforum/index.php?topic=1733.msg7631#msg7631

My Vector3 coordinates are randomly generated from a script that I'd been using with Vectrosity.  Now, aside from the randomly-generated path (which could have used any number of points, I just chose six for a test case) I actually have a library of paths - some hardcoded, some generated from the Superformula:

http://bl.ocks.org/mbostock/1021103
and
http://www.procato.com/superformula/ (check out the examples toward the bottom, great stuff!)

I want to be able to arbitrarily select a curve type and use it not just for paths, but also to generate shapes with Vectrosity and manipulate them with iTween.

So to draw any one of these at any given time will require "N" number of points, which will have to be reciprocated on the FSM side with the same number of variables.  And I will undoubtedly (because of how the app is designed) have multiple splines/shapes in any given scene.

I found it fairly easy to transfer the script-generated values to the FSM and have it accessible to the objects that I'm animating along the splines; and now it appears to be fairly easy to create new variables, so I'm going to continue along this trajectory for now, until my knowledge/understanding of PlayMaker gets to the next level, the "aha" moment comes, and I have to rewrite everything!  :)

Cheers,

==rr
Title: Re: Itween move to with exisiting paths
Post by: memetic arts on March 20, 2013, 04:02:08 AM
I was just looking at the Superformula links that I posted above -- hadn't been there for a while -- and started thinking how cool it would be to port that to a PM action . . . you wouldn't happen to know if that's been done already would you?

And how I wish there were a way to process/convert SVG data in Unity!
Title: Re: Itween move to with exisiting paths
Post by: FritsLyn on June 26, 2013, 07:37:34 AM
Tip:

It appears that the "iTween Move to V2" is not moving linear even on a single (2 points) path.. Well, it's not doing so if you have Move To Path on - that'll affect the whole trip .. I just realized ;)
Title: Re: Itween move to with exisiting paths
Post by: pdunton on July 19, 2013, 05:52:32 PM
Hi, I am somewhat new to Playmaker.  I have no idea how to install this.  And i am using this to fire a missile in a parabola arc in the direction in looking at.  Would this work?  Thanks!
Title: Re: Itween move to with exisiting paths
Post by: jeanfabre on July 28, 2013, 10:01:45 AM
Hi,

Yes you can. tho if you know where you want to fire but need more flexibilty, you could try this:

http://hutonggames.com/playmakerforum/index.php?topic=2373.msg11051#msg11051

 it's a way to define how far you want to shoot, but it uses physics. if you don't want to use physics, then yes, itween path is a good way to go.

bye,

Jean
Title: Re: Itween move to with exisiting paths
Post by: Headtrip on August 26, 2013, 10:41:09 AM
Thanks for this! Works well.   Does anyone know if there is a way to let the player control movement along this path.. Either by a gamepad joystick or button?  I would love to have the ability to ride the spline ( I have a camera on it) and be able to control my camera movement along the path... Thanks!
Title: Re: Itween move to with exisiting paths
Post by: wallaceb68 on August 26, 2013, 06:08:52 PM
i seem to be getting this error "Assets/iTweenMoveTo_v2.cs(187,69): error CS0117: `iTweenPath' does not contain a definition for `GetPathReversed' "
how do i fix this?

Title: Re: Itween move to with exisiting paths
Post by: wallaceb68 on August 27, 2013, 11:18:07 AM
also how do you get the moveto V2 into playmaker as a state? just a little confused here.
Title: Re: Itween move to with exisiting paths
Post by: wallaceb68 on August 28, 2013, 08:49:01 PM
ok i got it figured out. i made my paths with itween paths and im useing the itween move to v2 in playmaker. i put the path name in the box under path name, but it doesnt go on the path, the object just go's to the center of the room and stay's there. any ideal what im doing wrong?
Title: Re: Itween move to with exisiting paths
Post by: wallaceb68 on August 29, 2013, 02:27:06 PM
ok got that figured out. my object is running on a single path.
now what i need to know is how can i set a string variable that will randomly select itween path for the object? the paths are attached to the object.
Title: Re: Itween move to with exisiting paths
Post by: jeanfabre on September 10, 2013, 04:44:49 AM
Hi,

 using iTween move to 2, you simply need to reference the name of the itween path, so that's what you are randomizing.. Likely using an action such as "Select Random String", or if you want more control using arrayMaker, referencing each path in an array and then pick a random item in that array.

bye,

 Jean
Title: Re: Itween move to with exisiting paths
Post by: bizilux on September 14, 2013, 05:09:46 AM
good job, nice action... just what i needed!

one question though... my game is in 2D... is it possible to use "LookAt" and have it configured to only rotate my player on Z axis? 
(because for 2D, you can only rotate on Z axis, if you rotate on any other axis, the player will disappear)
or what would be the best way to make rotation here?
Title: Re: Itween move to with exisiting paths
Post by: jeanfabre on September 15, 2013, 10:56:05 PM
Hi,

 Have you tried this:
http://hutonggames.com/playmakerforum/index.php?topic=4918.msg23063#msg23063

bye,

 Jean
Title: Re: Itween move to with exisiting paths
Post by: bizilux on September 16, 2013, 12:48:17 PM
thanks...
i actually checked this action few days ago, i even checked tank example... but then i thought this is not it, this is for tanks...

ok well i tried implementing it, but man... i just dont understand this look at action at all... you have some up vector

i did check the tank example... i still dont get it what is the deal with that up vector, i mean i have to specify around which axis i want it to rotate... but no idea how...


and even if i figured out how to point my soldier towards those coordinates, i then wouldnt be able to point him to next node once he reaches that node...

i dont think i could use this action in conjunction with iTween Move To_v 2.... correct me if im wrong..

i attached my itween soldier, and itween path...
Title: Re: Itween move to with exisiting paths
Post by: jeanfabre on September 16, 2013, 11:38:00 PM
Hi,

 ok, maybe I misunderstand what you want to achieve. Can you rephrase? that will help talking about the same thing.

bye,

 Jean
Title: Re: Itween move to with exisiting paths
Post by: bizilux on September 17, 2013, 02:21:47 AM
this is how it is now:
soldier just follows itween path, facing same direction to the right, all the time
(http://i.imgur.com/ypbFeWa.jpg)

and this is how it should be... (i manually rotated him on Z axis only)
(http://i.imgur.com/obnXjz2.jpg)
he should be  facing towards next node...
Title: Re: Itween move to with exisiting paths
Post by: jeanfabre on September 17, 2013, 11:24:09 PM
Hi,

 You likely want to set the "look ahead" to a very very small percent, so that it looks right at the path in front of itself. something like 0.1 or something.

 Bye,

 Jean
Title: Re: Itween move to with exisiting paths
Post by: bizilux on September 18, 2013, 05:10:09 AM
as far as i see, look ahead works in conjunction with orient to path , so i ticked that too...

he does orient to path and all... but still disappears from the scene...   i tried all of  those Axis settings... but no luck

(http://i.imgur.com/4QUv60T.jpg)

these 2D things can be so complicated at times in unity...
Title: Re: Itween move to with exisiting paths
Post by: jeanfabre on September 20, 2013, 12:01:39 AM
Hi,

 disappear? you have something really weird going on.

 could it disappear because your camer clipping is too short? what 2d kit are you using? Mayb it is in conflict actually.

bye,

 Jean
Title: Re: Itween move to with exisiting paths
Post by: kici on March 01, 2014, 12:23:53 PM
I cannot find iTween Move TO V2 has that been changed, if so how do you make it work?

I tried putting an "id" but I don't think thats for the iTween path.

Please let me know.

Thanks
Title: Re: Itween move to with exisiting paths
Post by: kici on March 03, 2014, 05:38:32 PM
bump
Title: Re: Itween move to with exisiting paths
Post by: jeanfabre on March 04, 2014, 04:04:33 AM
Hi,

 this is the post with that v2 action:

http://hutonggames.com/playmakerforum/index.php?topic=1699.0

If you still have problems, let me know.

bye,

 Jean
Title: Re: Itween move to with exisiting paths
Post by: kici on March 04, 2014, 05:13:24 PM
Oooh, its an attachment we have to download.

My apologies did not see.

THanks
Title: Re: Itween move to with exisiting paths
Post by: ing.prokop on November 05, 2014, 03:17:15 PM
hi There,
I downloaded moveto_v2, but I got compiling errors (no definition for "reverse path")...
can you help?
thanks
Title: Re: Itween move to with exisiting paths
Post by: Headtrip on November 06, 2014, 09:33:27 PM
I'm getting the same error  :'(
Title: Re: Itween move to with exisiting paths
Post by: WatThaDeuce on May 06, 2015, 12:46:05 AM
Hi, sorry to res this thread but I am also getting multiple compile errors with Unity on this script with Unity 5.  After clearing the reverse path error, i now get this one:

Assets/iTweenMoveTo_v2.cs(192,36): error CS1519: Unexpected symbol `=' in class, struct, or interface member declaration
Title: Re: Itween move to with exisiting paths
Post by: jeanfabre on August 27, 2015, 10:57:53 PM
Hi, sorry to res this thread but I am also getting multiple compile errors with Unity on this script with Unity 5.  After clearing the reverse path error, i now get this one:

Assets/iTweenMoveTo_v2.cs(192,36): error CS1519: Unexpected symbol `=' in class, struct, or interface member declaration

HI,

 I'll have a look, please bump me mid next week, if I haven't had time.

 Bye,

 Jean
Title: Re: Itween move to with exisiting paths
Post by: bitpocketer on December 09, 2015, 08:26:18 AM
Hi,
I want to download the extended version of moveto action, I'm not allowed to download that section, how do i get it?
Title: Re: Itween move to with exisiting paths
Post by: SpencerPDX on October 19, 2016, 02:39:59 PM
Hello! I realize this is an old thread, but it still seems to be the most relevant.

I tried using the action originally posted at the start of this thread, iTweenMoveTo_v2.cs, but I got the error:

Assets/PlayMaker/Actions/iTweenMoveTo_v2.cs(66,38): error CS0115: `HutongGames.PlayMaker.Actions.iTweenMoveTo_v2.OnDrawGizmos()' is marked as an override but no suitable method found to override

To get to where I could run in game mode, and not being sure what else to do, I commented out lines 66-78. That at least let me run, but I'm not sure what else I might have broken in the process. The object I'm trying to animate, a plane, does follow the path - and that's a relief - but it's not orienting itself along the direction of movement. Not sure if that's related.

Greatly appreciate the custom action, any further help would be most welcome.
Title: Re: Itween move to with exisiting paths
Post by: jeanfabre on October 24, 2016, 11:36:27 PM
Hi,

 Can you get the version from the Ecosystem that I just uploaded, it fixes the issue.

 Bye,

 Jean
Title: Re: Itween move to with exisiting paths
Post by: SpencerPDX on November 18, 2016, 02:15:45 PM
A month later, and I finally got a chance to install Ecosystem and give this fix a try. It worked! The errors seem to be no more.

Incidentally, I mentioned not being able to get the plane to orient itself to the path, despite having "Orient to Path" checked. I found the answer to that problem here:

http://hutonggames.com/playmakerforum/index.php?topic=3359.0

...where courtneyrocks says:

Quote
You have to include a Look Ahead value. I think this determines how far ahead on the path the object is looking. I ended up using a a value of 0.001 and it finally works as it should.

Vitally important info, IMO. Obviously it's more an issue with itween than with Playmaker, but on Playmaker's side, in the tooltip for the Look Ahead value, which currently says you can enter a value between 0 and 1, it would be really helpful if it mentioned that 0.001 is a good value to for getting the object to orient to a path without any derivation - the way I would think most people would expect it to work.

Normally I can just trial-my-error my way into figuring something like that out, but I tried 1, then 0, then .5 then .3 ... None of them came close to working. With 0 having not worked, it didn't occur to me that a tiny fraction higher (.001) would work perfectly.

Thanks again!
Title: Re: Itween move to with exisiting paths
Post by: jeanfabre on November 24, 2016, 12:02:44 AM
Hi

 Done :)

 Bye,

 Jean
Title: Re: Itween move to with exisiting paths
Post by: cgmonkey on December 07, 2016, 01:30:59 PM
Hi, sorry if I missed it but the speed seems to be based on the distance between the nodes?
Can I change this to be a constant speed? or control the speed myself?
I've tried the time option and the speed option but both slow down if the nodes are closer together
Title: Re: Itween move to with exisiting paths
Post by: tankun on August 06, 2017, 09:06:37 AM
Hi, sorry if I missed it but the speed seems to be based on the distance between the nodes?
Can I change this to be a constant speed? or control the speed myself?
I've tried the time option and the speed option but both slow down if the nodes are closer together

It's an old issue I'm aware but I'm curious about the answer to this question too. Is there a way to make the speed constant between path nodes?
Title: Re: Itween move to with exisiting paths
Post by: djaydino on August 09, 2017, 12:41:53 AM
Hi,
Itween is outdated and sloooow

you should use dotween (https://www.assetstore.unity3d.com/en/#!/content/27676) instead,
you can get actions for dotween here (http://hutonggames.com/playmakerforum/index.php?topic=10303.0)
Title: Re: Itween move to with exisiting paths
Post by: kavery on August 29, 2017, 02:35:48 PM
Can you control speed with Dotween? As people mentioned above, the speed depends on the distance between nodes. I need something that is a steady pace.

Looping a path would be nice too, Or maybe I just put the end next tot he start node and replay moveTo.
Title: Re: Itween move to with exisiting paths
Post by: djaydino on August 29, 2017, 07:26:49 PM
Hi,
In the loop section you have several settings

best is to play around with them to understand how they work :)
Title: Re: Itween move to with exisiting paths
Post by: kavery on August 30, 2017, 06:51:57 AM
Well there is loop type to continue the movement, and then there is looping/connecting the curve itself. It was a pleasure to realize that if you copy the location inputs of the first node and paste to the last node, the curve actually connects and smooths out.

EDIT: However the point where the start and end meet causes a nasty jerk when the MoveTov2 starts a new loop.  :(
Title: Re: Itween move to with exisiting paths
Post by: djaydino on September 04, 2017, 09:49:29 AM
Hi,
To fine tune can be tricky sometimes,

Can you make a simple scene only with this move to, and export / upload  or a video showing the issue + actions/states/fsms/variables?