Playmaker Forum

Playmaker Updates & Downloads => Share New Actions => Topic started by: holyfingers on September 18, 2015, 08:06:31 AM

Title: Draw Bézier Curve Action
Post by: holyfingers on September 18, 2015, 08:06:31 AM
Hi there,

Couldn't find an action for drawing a curve anywhere so thought I'd try and put one together...

(http://i.imgur.com/wLjHwQn.gif)

It's based on the existing Draw Line action from here: http://hutonggames.com/playmakerforum/index.php?topic=3943.0 (http://hutonggames.com/playmakerforum/index.php?topic=3943.0) though it doesn't have quite as many options, I might add them in later on.

The code for defining the curve comes from here: https://en.wikibooks.org/wiki/Cg_Programming/Unity/B%C3%A9zier_Curves (https://en.wikibooks.org/wiki/Cg_Programming/Unity/B%C3%A9zier_Curves)

First attempt at making a custom action and I'm not much of a coder so let me know if there's anything that needs fixed/changed!

Cheers,

Nick
Title: Re: Draw Bézier Curve Action
Post by: dudebxl on September 18, 2015, 11:03:23 AM
cool  ;D
Title: Re: Draw Bézier Curve Action
Post by: boragungor on September 18, 2015, 12:07:52 PM
Thanks  :)
Title: Re: Draw Bézier Curve Action
Post by: holyfingers on September 20, 2015, 08:21:05 AM
Managed to get the Spline code from that page working as well, so you can now define how many points you want to use. Not quite as straightforward as before, it needs at least 5 control points and your Start point and End point need to occupy the first two and last two slots for the spline to reach the ends.

(http://i.imgur.com/DqkAeeo.png?2)

Could be a lot tidier, it would be nice to be able to set the Start and End points and just use the compound array for the Middle ones for example. I also couldn't find a way to use just one input per array item hence the empty Label strings. It seems to be working pretty well though so I'd thought I'd share it as is.

Again, let me know if there are any issues I've missed!

Cheers,

Nick
Title: Re: Draw Bézier Curve Action
Post by: Lane on September 20, 2015, 08:29:32 AM
Looks cool!

I haven't checked the code out yet but since you're still tinkering with it I thought I would drop Jasper Flick's Bezier tutorial (http://catlikecoding.com/unity/tutorials/curves-and-splines/) since its got some nifty solutions in it. Might help tidy things up for you. =)
Title: Re: Draw Bézier Curve Action
Post by: holyfingers on September 20, 2015, 08:36:44 AM
Oh wow that looks amazing! :D Covers placing objects along curves as well which would be really handy!

Cheers Lane! 
Title: Re: Draw Bézier Curve Action
Post by: elvis75k on September 20, 2015, 02:08:20 PM
Great, thank for sharing.
Title: Re: Draw Bézier Curve Action
Post by: play_edu on September 20, 2015, 08:55:23 PM
 ::) ::) ::)
Title: Re: Draw Bézier Curve Action
Post by: jeanfabre on September 21, 2015, 04:19:20 AM
Hi,

 Yeah, these are great actions!

I took the opportunity here to make a video showing how to publish your work on the Ecosystem via the snipt website. It's free and it allows you to effortlessy distribute your work to PlayMaker user very easily,

If you want to do this for your actions, let me know and I Can delete the drawcurve snipt from my account. But no worries if you don't feel like it, it's just a suggestions. I'll add them myself otherwise, it's ok.

Video (https://youtu.be/VQUsFVWmmUo)

 Bye,

 Jean
Title: Re: Draw Bézier Curve Action
Post by: holyfingers on September 21, 2015, 04:57:16 AM
Hey Jean,

Glad you like them! :D

Just signed up for a free Snipt account there now, out of curiosity how does Ecosystem handle updates? Is there anything to be aware of if I put the actions up and then make some changes to them later on?

Cheers,

Nick
Title: Re: Draw Bézier Curve Action
Post by: jeanfabre on September 21, 2015, 06:29:22 AM
Hi,

 very good! thanks :)

 Right now there isn't any update system per say. you can update the code, but the user will need to be made aware of updates.

 the ecosystem is certainly going to implement such a feature in the comin month, but first I need to get out of the door several pending feature.

 I would suggest simply tweet about your updates, and post on the forum on the related thread.

 Bye,

 Jean
Title: Re: Draw Bézier Curve Action
Post by: holyfingers on September 21, 2015, 06:43:24 AM
Thanks Jean!

Had to just fix the DrawSpline action there quickly because of a silly copy/paste error, the version here and on Ecosystem both seem to be working now though!

Cheers,

Nick
Title: Re: Draw Bézier Curve Action
Post by: jeanfabre on September 21, 2015, 06:47:12 AM
Hi,

 Yeah, it's part of the process, no one will hold you liable, script needs to evolve, and it's ok. If your action doesn't work, people will come back to you, don't worry :)

Update system will come soon, I know it will be a big plus on comfort for both publishers and consumers. But I want to get it right, and it's tricky without a proper back end, here I am only the middle mand between snipt/github and Unity, with update awareness, it's a different deal all together :) I am thinking of opening a channel of communication right within the ecosystem browser so that publishers can register their changes. The other way is a project scanner that would scan and tell you what can be updated. that's likely coming first.



 Bye,

 Jean
Title: Re: Draw Bézier Curve Action
Post by: holyfingers on March 11, 2016, 09:27:53 AM
I've just updated these actions on Ecosystem/Snipt, they both now include a toggle for destroying the line rendering object on exiting the state...

*EDIT: Removed Snipt links*

Cheers,

Nick
Title: Re: Draw Bézier Curve Action
Post by: OcravioG on October 08, 2017, 11:26:11 PM
Hey Jean the vids unavailable. But thanks for the curved line tool. I'll be using it a lot if I can figure out how to use it lol.
Title: Re: Draw Bézier Curve Action
Post by: holyfingers on October 09, 2017, 02:21:53 AM
Hey there, updated the two scripts to remove errors in Unity 2017.1, haven't got round to putting them back up on Ecosystem yet since Snipt dissappeared.

Also removed the Snipt links from previous post as they were redirecting to an unrelated Github repo!?

Updated Draw Curve and Draw Spline actions attached...
Title: Re: Draw Bézier Curve Action
Post by: jeanfabre on October 11, 2017, 01:05:46 AM
Hi,

 thanks :) on the Ecosystem now!

 Bye,

 Jean
Title: Re: Draw Bézier Curve Action
Post by: Groo Gadgets on October 11, 2017, 05:27:29 AM
Very nice! Thanks for the share!   ;D
Title: Re: Draw Bézier Curve Action
Post by: holyfingers on November 07, 2017, 07:40:30 AM
Another quick update, you can now specify a GameObject variable for the created lineRenderer...

Cheers,

Nick
Title: Re: Draw Bézier Curve Action
Post by: omgitstri on November 07, 2017, 11:58:18 AM
This is great! Thank you!