playMaker

Author Topic: Itween move to with exisiting paths  (Read 46424 times)

memetic arts

  • Full Member
  • ***
  • Posts: 141
Re: Itween move to with exisiting paths
« Reply #15 on: March 19, 2013, 02:20:48 PM »
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 . . .
« Last Edit: March 19, 2013, 02:23:30 PM by rrodkin »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Itween move to with exisiting paths
« Reply #16 on: March 20, 2013, 02:54:15 AM »
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

memetic arts

  • Full Member
  • ***
  • Posts: 141
Re: Itween move to with exisiting paths
« Reply #17 on: March 20, 2013, 06: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
« Last Edit: March 22, 2013, 11:11:36 AM by rrodkin »

memetic arts

  • Full Member
  • ***
  • Posts: 141
Re: Itween move to with exisiting paths
« Reply #18 on: March 20, 2013, 07: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!

FritsLyn

  • Full Member
  • ***
  • Posts: 191
Re: Itween move to with exisiting paths
« Reply #19 on: June 26, 2013, 10: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 ;)

pdunton

  • Playmaker Newbie
  • *
  • Posts: 35
Re: Itween move to with exisiting paths
« Reply #20 on: July 19, 2013, 08: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!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Itween move to with exisiting paths
« Reply #21 on: July 28, 2013, 01:01:45 PM »
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

Headtrip

  • Playmaker Newbie
  • *
  • Posts: 25
Re: Itween move to with exisiting paths
« Reply #22 on: August 26, 2013, 01:41:09 PM »
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!

wallaceb68

  • Junior Playmaker
  • **
  • Posts: 87
Re: Itween move to with exisiting paths
« Reply #23 on: August 26, 2013, 09: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?


wallaceb68

  • Junior Playmaker
  • **
  • Posts: 87
Re: Itween move to with exisiting paths
« Reply #24 on: August 27, 2013, 02:18:07 PM »
also how do you get the moveto V2 into playmaker as a state? just a little confused here.

wallaceb68

  • Junior Playmaker
  • **
  • Posts: 87
Re: Itween move to with exisiting paths
« Reply #25 on: August 28, 2013, 11: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?

wallaceb68

  • Junior Playmaker
  • **
  • Posts: 87
Re: Itween move to with exisiting paths
« Reply #26 on: August 29, 2013, 05: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.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Itween move to with exisiting paths
« Reply #27 on: September 10, 2013, 07: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

bizilux

  • Full Member
  • ***
  • Posts: 171
Re: Itween move to with exisiting paths
« Reply #28 on: September 14, 2013, 08: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?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Itween move to with exisiting paths
« Reply #29 on: September 16, 2013, 01:56:05 AM »