playMaker

Author Topic: Grid Movement ( Like Frogger 2 /Crossy road)  (Read 1775 times)

necrio2

  • Playmaker Newbie
  • *
  • Posts: 15
    • View Profile
Grid Movement ( Like Frogger 2 /Crossy road)
« on: April 11, 2018, 05:50:18 PM »
Hello,

I am trying to learn grid movement. Similiar to frogger 1/2. Where the player moves one tile at a time.

I have googled and search through these forums and youtube, but cannot find and a good enough solution.

So, when I have simple grid movement ( Move to/ iTween move to/Move by..move towards/move towards advanced) I have no collision. Tried Rigidbody/colliders on/off everything.


My question is how to do grid movement But still have collisions?

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 997
    • View Profile
    • Fat Pug Studio
Re: Grid Movement ( Like Frogger 2 /Crossy road)
« Reply #1 on: April 12, 2018, 12:02:38 AM »
What is the problem with colisions? If you're having a rigidbody and colliders, any collision should be detected, unless the movement is too fast, collider is too small, or your movement is actually just setting position instead of moving the transform from one point to another.

I can post you a small example when i get to desktop.

necrio2

  • Playmaker Newbie
  • *
  • Posts: 15
    • View Profile
Re: Grid Movement ( Like Frogger 2 /Crossy road)
« Reply #2 on: April 12, 2018, 02:13:18 AM »
Here is a GIF of the 'no collision'

Plus the movement I am using currently.

https://imgur.com/a/p8WXn

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 997
    • View Profile
    • Fat Pug Studio
Re: Grid Movement ( Like Frogger 2 /Crossy road)
« Reply #3 on: April 12, 2018, 03:08:22 AM »
Is there a collider on the player? Rigidbody? Rigidbody typer set to appropriate types? Collision matrix set for the layers to collide?

necrio2

  • Playmaker Newbie
  • *
  • Posts: 15
    • View Profile
Re: Grid Movement ( Like Frogger 2 /Crossy road)
« Reply #4 on: April 12, 2018, 03:41:23 AM »
I have set it
Player and Box
Rigidbody   / box collider  on and off ( to test )

 In addition, I've tried kinematic and gravity on and off.

changed tags to player / enemy.

not sure what else to try.

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 997
    • View Profile
    • Fat Pug Studio
Re: Grid Movement ( Like Frogger 2 /Crossy road)
« Reply #5 on: April 12, 2018, 06:13:32 AM »
Try out setting them both to kinematic, simulated and full kinematic contacts checked, continuous collision detection, start awake.

necrio2

  • Playmaker Newbie
  • *
  • Posts: 15
    • View Profile
Re: Grid Movement ( Like Frogger 2 /Crossy road)
« Reply #6 on: April 13, 2018, 02:40:11 AM »
Actually tried that. Didn't work.

Played with settings all night.

The only thing that worked right was the get vec axis / controller move. That had the movement plus the collision. But it wasn't the 'grid' movement I wanted.

I was reading some stuff and thinking of using arraymaker, making an array grid and movement through that.

However, I don't know how I'd do that yet. Does anyone have a way to make a grid movement with arrays?

Thanks!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4613
    • View Profile
    • jinxtergames
Re: Grid Movement ( Like Frogger 2 /Crossy road)
« Reply #7 on: April 13, 2018, 08:43:34 AM »
Hi,
I made you a sample prefab that you can try out in the attachment.

and a video with some explanation but not with arrays :



necrio2

  • Playmaker Newbie
  • *
  • Posts: 15
    • View Profile
Re: Grid Movement ( Like Frogger 2 /Crossy road)
« Reply #8 on: April 13, 2018, 03:14:13 PM »
Thanks a ton, Diaydino.

Definitely helped solve the problem. I was working with raycast and getting somewhere. However, you fixed the missing piece.

I am gonna play with this a bit, set it up, and make a tutorial so you ( or another admin ) can post it to the tutorials. This can be useful, but enough out there to help with this subject!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4613
    • View Profile
    • jinxtergames
Re: Grid Movement ( Like Frogger 2 /Crossy road)
« Reply #9 on: April 13, 2018, 05:23:55 PM »
Hi.
I am happy it helped :)

I am actually planning to make a tutorial on this also, but i am still playing around with some other movement styles :)