playMaker

Author Topic: Smooth Translation in a Direction  (Read 126 times)

Ulrick

  • Playmaker Newbie
  • *
  • Posts: 7
    • View Profile
Smooth Translation in a Direction
« on: August 07, 2018, 09:57:53 PM »
Hello,

My problem is probably super simple but I can't find the solution:

I have an old school dungeon crawler system: 1st Person square by square movement. (Grimrock, Dungeon Master, etc.)
The movement is simple: When you press a key, you move by 1 unit in that direction (every square is a 1 unit square, handy !)

I'm using a simple translate (no need for a character controller or full 360 physics movement here), but my translations are instant.

How could I have a slow and smooth translation from one square to another.
(like 1 second for example, with speed increase / decrease with a curve, between each square) ?

Thanks a lot ! I'm stupidly blocking on something that looks easy...

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 3241
    • View Profile
    • jinxtergames
Re: Smooth Translation in a Direction
« Reply #1 on: August 08, 2018, 12:02:59 AM »
hi.
Get the current position, then use a operator to add a value for the new position and store in another variable (call it 'new position' for example)

Then for now you could use a float/vector2/vector3 interpolate action (There will be native tween actions with more options included in one of the next PlayMaker updates) and set the mode to ease in out and place the current position and the new position in it.
You can set the time to your needs.
Also set an event for when the action is Finished.
Store in a variable (call it 'Moving' for example)

Then use a 'set position' and turn on 'Every Frame' and place the 'Moving' variable.

In the next state do another 'set position' with 'Evety Frame' disabled and place the  'new position' variable.
This is just to be sure that the final position is correct.

miguelfanclub

  • Junior Playmaker
  • **
  • Posts: 72
    • View Profile
Re: Smooth Translation in a Direction
« Reply #2 on: August 08, 2018, 01:37:33 AM »
Use the tween actions for that. You have durations and curves.

Ulrick

  • Playmaker Newbie
  • *
  • Posts: 7
    • View Profile
Re: Smooth Translation in a Direction
« Reply #3 on: August 09, 2018, 09:11:53 PM »
Hi guys !

Thanks for your feedback :)

I don't have de Tween options, even installing iTween ?
Do I need to reinstall Playmaker after ?

Anyway, I tried djaydino's method, and it works... almost ! :D
It move, with an ease and all...

But it moves in world position. In Local my Z is always the front of the player but it always goes in the World Z... even if I choose self for any of the actions (Set Position and Get Position... kinda weird)

Thanks already !

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 3241
    • View Profile
    • jinxtergames
Re: Smooth Translation in a Direction
« Reply #4 on: August 09, 2018, 09:25:43 PM »
Hi.
Do you have 'Get Position' and 'Set Position' both set to 'space : self'

Its best not to use iTween as it is outdated and slow.
the new native tween action are coming soon :)

Ulrick

  • Playmaker Newbie
  • *
  • Posts: 7
    • View Profile
Re: Smooth Translation in a Direction
« Reply #5 on: August 09, 2018, 09:47:32 PM »
Yes for the Get and the Set, I join a screenshot of the action stack if you want to check, thanks for your time !

Ulrick

  • Playmaker Newbie
  • *
  • Posts: 7
    • View Profile
Re: Smooth Translation in a Direction
« Reply #6 on: August 10, 2018, 05:22:43 PM »
(I tried with a Vector3 but the result is far worst :D haha)

Ulrick

  • Playmaker Newbie
  • *
  • Posts: 7
    • View Profile
Re: Smooth Translation in a Direction
« Reply #7 on: August 13, 2018, 09:52:22 PM »
Hello, me again :D

I tried with a Translate, apparently it keeps the Self/Local coordinates, but don't behave correctly (I can't have it move the right amount of unit in the right amount of time)

So it's the Set Position which can't move it in the Local coordinates even if Self is checked... Is this normal ?