playMaker

Author Topic: Doodle Jump like smooth movement  (Read 6385 times)

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Doodle Jump like smooth movement
« Reply #15 on: October 27, 2018, 06:36:50 AM »
Hi.

I do think that IgnoreLayerCollision2D will be faster as it would only change a bool.
I think changing the layer is a bigger process to do (code wise)

You could find out with the profiler, but do it with lots of objects at the same time as else it would be to small to notice.



szomaza

  • Sr. Member
  • ****
  • Posts: 253
Re: Doodle Jump like smooth movement
« Reply #16 on: December 01, 2018, 11:39:46 AM »
I made some progress.
My camera is now Cinemachine which seems to be quite smooth and I can handle various camera behaviors I will need later.

Also I changed now from moving the player with RigidBody2dMovePosition (which was quite jittery) to SetVelocity2D as this guy explains here:
That is smooth, just jumping up and down, but then he explains how to do about the same for the horizontal movement, here:
which part I am unable to replicate in Playmaker.

My problem is that I am not not sure what I should do differently to get his result.
Is this even possible in Playmaker?
Please check the attached image and tell me if this is even possible.

It seems so simple, but what is the problem?

There is one FSM which is doing the up and down jumping with SetVelocity2D once every time a platform 2D collider is entered.
I guess the problem is with the EveryFrame part of this horizontal movement FSM actions, they get the velocity of the object add the horizontal movement and then set the velocity every frame, so that is why the character flies away when this FSM is active.
What is he doing differently in his script? He does not have everyframe there but fixedupdate.

Please shed some light!

Thore

  • Sr. Member
  • ****
  • Posts: 480
Re: Doodle Jump like smooth movement
« Reply #17 on: December 01, 2018, 07:06:42 PM »
I already explained how to do this a page ago. If that doesn’t help, look here: https://hutonggames.com/playmakerforum/index.php?topic=19504.0

szomaza

  • Sr. Member
  • ****
  • Posts: 253
Re: Doodle Jump like smooth movement
« Reply #18 on: December 02, 2018, 05:12:22 AM »
Thanks Thore!
I totally forgot about your initial suggestions from a page before.
I was trying to come up with a solution myself, but now your suggestions make much more sense to me reading them again.
I'll continue and wrap my head around them....

Thanks a bunch!

edit: I tried your AxisToVelocity2D and it works really nicely.
Thank you very much!
« Last Edit: December 03, 2018, 01:16:48 PM by szomaza »