playMaker

Author Topic: Draw Bézier Curve Action  (Read 19642 times)

holyfingers

  • Playmaker Newbie
  • *
  • Posts: 34
  • 3D-artist and fledgling Unity Dev.
    • holyfingers.co.uk
Draw Bézier Curve Action
« on: September 18, 2015, 11:06:31 AM »
Hi there,

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



It's based on the existing Draw Line action from here: 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

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
Twitter: @holyfingers

dudebxl

  • Hero Member
  • *****
  • Posts: 602
Re: Draw Bézier Curve Action
« Reply #1 on: September 18, 2015, 02:03:23 PM »
cool  ;D

boragungor

  • Playmaker Newbie
  • *
  • Posts: 17
  • Who really wrote Beethoven's music to begin with?
Re: Draw Bézier Curve Action
« Reply #2 on: September 18, 2015, 03:07:52 PM »
Thanks  :)

holyfingers

  • Playmaker Newbie
  • *
  • Posts: 34
  • 3D-artist and fledgling Unity Dev.
    • holyfingers.co.uk
Re: Draw Bézier Curve Action
« Reply #3 on: September 20, 2015, 11: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.



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
« Last Edit: September 21, 2015, 09:37:18 AM by holyfingers »
Twitter: @holyfingers

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Draw Bézier Curve Action
« Reply #4 on: September 20, 2015, 11: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 since its got some nifty solutions in it. Might help tidy things up for you. =)
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

holyfingers

  • Playmaker Newbie
  • *
  • Posts: 34
  • 3D-artist and fledgling Unity Dev.
    • holyfingers.co.uk
Re: Draw Bézier Curve Action
« Reply #5 on: September 20, 2015, 11:36:44 AM »
Oh wow that looks amazing! :D Covers placing objects along curves as well which would be really handy!

Cheers Lane! 
Twitter: @holyfingers

elvis75k

  • Beta Group
  • Junior Playmaker
  • *
  • Posts: 97
    • nRender
Re: Draw Bézier Curve Action
« Reply #6 on: September 20, 2015, 05:08:20 PM »
Great, thank for sharing.

play_edu

  • Full Member
  • ***
  • Posts: 116
Re: Draw Bézier Curve Action
« Reply #7 on: September 20, 2015, 11:55:23 PM »
 ::) ::) ::)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Draw Bézier Curve Action
« Reply #8 on: September 21, 2015, 07: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

 Bye,

 Jean

holyfingers

  • Playmaker Newbie
  • *
  • Posts: 34
  • 3D-artist and fledgling Unity Dev.
    • holyfingers.co.uk
Re: Draw Bézier Curve Action
« Reply #9 on: September 21, 2015, 07: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
Twitter: @holyfingers

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Draw Bézier Curve Action
« Reply #10 on: September 21, 2015, 09: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

holyfingers

  • Playmaker Newbie
  • *
  • Posts: 34
  • 3D-artist and fledgling Unity Dev.
    • holyfingers.co.uk
Re: Draw Bézier Curve Action
« Reply #11 on: September 21, 2015, 09: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
Twitter: @holyfingers

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Draw Bézier Curve Action
« Reply #12 on: September 21, 2015, 09: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

holyfingers

  • Playmaker Newbie
  • *
  • Posts: 34
  • 3D-artist and fledgling Unity Dev.
    • holyfingers.co.uk
Re: Draw Bézier Curve Action
« Reply #13 on: March 11, 2016, 11: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
« Last Edit: October 09, 2017, 05:16:56 AM by holyfingers »
Twitter: @holyfingers

holyfingers

  • Playmaker Newbie
  • *
  • Posts: 34
  • 3D-artist and fledgling Unity Dev.
    • holyfingers.co.uk
Re: Draw Bézier Curve Action
« Reply #14 on: October 09, 2017, 05: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...
Twitter: @holyfingers