playMaker

Author Topic: Set Position - "additive" option erm... added :)  (Read 6691 times)

MaDDoX

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 165
    • FluidPlay Studios
Set Position - "additive" option erm... added :)
« on: May 27, 2011, 11:34:04 AM »
I can't believe I forgot to post this action before, I found it to be absolutely handy in my workflow. Many times all you want to do is offset an object by a certain amount (say, "speed"), and having to fiddle with custom variables to remember the old position and add to it can be a quite cumbersome way to do this. iTween is sheer overkill for such linear, stepped operations and the "translate" action is a continuous, perma-state operation, so very hard to be useful for things other than controllers.

Thus this modified "set position" action, excellent for so many simple translation operations that I wouldn't be able to list them all. Simply replace the default setposition.cs action (in assets/playmaker) and it'll be ready for use. Just toggle on the "additive" button and presto. Enjoy! :)
--
Breno "MaDDoX" Azevedo
@brenoazevedo

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Set Position - "additive" option erm... added :)
« Reply #1 on: May 27, 2011, 03:49:58 PM »
Hi Maddox.

 Very cool , I actually builded the vector3 operator action cause I needed that kind of math, tho slightly different from a straight additive, I often base offset using the start position, not the current, maybe your set position could have an second option to "additive from start", that would then cover both case.

Bye,

 Jean

Andrew.Lukasik

  • Full Member
  • ***
  • Posts: 134
    • my twitter @andrewlukasik
Re: Set Position - "additive" option erm... added :)
« Reply #2 on: January 02, 2012, 12:51:22 PM »
I dont know if that just my fault but it seems to don't work anymore. Despite "Additive" flag set - it works only as original "Set Position" in my project. Any ideas?

Andrew.Lukasik

  • Full Member
  • ***
  • Posts: 134
    • my twitter @andrewlukasik
Re: Set Position - "additive" option erm... added :)
« Reply #3 on: January 02, 2012, 12:53:29 PM »
This action needs some more love imo. We need solid and instant Position Offset Action - something that is needed by many beginners and pros, but verbalized probably by no one.

Situation:
I made a prototype door/trap/button/etc as a prefab. And when object is fired by trigger I want to simply move it by its local axis by N in XYZ direction.

Current Solution:
As far as I know its pretty complicated thing to do right now. Actually too complicated as for something that common:
-get pos V3 i local or word pos
-make math on that V3
-now set pos with new V3

It seems easy for coder or pro-user but I've found that it is very hard to do for beginners because they need to know what V3 is and be good with PM (often takes many hours and deep google-research). Result - they give up and I've seen such situations.
« Last Edit: January 02, 2012, 04:36:25 PM by Andrew_Raphael_Lukasik »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Set Position - "additive" option erm... added :)
« Reply #4 on: January 02, 2012, 02:58:34 PM »
Not at my computer right now, but there should be a Translate action that will do that in one step...

Andrew.Lukasik

  • Full Member
  • ***
  • Posts: 134
    • my twitter @andrewlukasik
Re: Set Position - "additive" option erm... added :)
« Reply #5 on: January 02, 2012, 04:30:45 PM »
Hi Alex
Do you mean "Translate" action? As far as I know it only adds XYZ per frame/second. So the effect here is constant move only.
But adding flag like "repeat until exit"/"apply once" or something would do the job perfectly i think
Greetings!
« Last Edit: January 02, 2012, 04:33:17 PM by Andrew_Raphael_Lukasik »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Set Position - "additive" option erm... added :)
« Reply #6 on: January 02, 2012, 11:14:13 PM »
Hi,

 Yes the translation does not have the ability to run once and trigger the finished event. And using send Event action to exit the state makes the translation action not doing its job since it translates on update.

I tested Maddox SetPositionAdditive to match your needs and it works. I have attached a screenshot of the setup. Tell me if you are having problems implementing it on your end.

 Bye,

 Jean

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Set Position - "additive" option erm... added :)
« Reply #7 on: January 02, 2012, 11:42:48 PM »
Hmmm, Translate should probably have an Every Frame option. It will have to default to true to not break the old behaviour though...

tobbeo

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 186
Re: Set Position - "additive" option erm... added :)
« Reply #8 on: January 03, 2012, 12:48:32 AM »
The way I've always done it is using "Set Position", every frame checked and then have an animated Float which has always worked fine (then simple Compare Float actions to exit the Event), or "Translate" when there's no need for anything else. "Set Additive" negates the need for an animated value though which is nice. Having an "every frame" in "Translate" would be pretty good (though not sure why you would want to do that over using Set Position) but for consistency's sake it would be nice.