playMaker

Author Topic: Make object move continuously into a direction and turn left on trigger  (Read 1139 times)

KSE

  • Playmaker Newbie
  • *
  • Posts: 1
Hi. I am new to Unity and Playmaker. I would like to try some sort of ChuChu Rocket  clone. I would need to make a game object move - lets say to the south, until it enters a field/trigger that tells the object to turn left/right/back and continue into that direction (west/south/east/north). Any advice on how to do that? I found tutorials for applying force and stuff, but that is not what i need, i guess.
« Last Edit: August 20, 2020, 05:30:06 AM by KSE »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Make object move continuously into a direction and turn left on trigger
« Reply #1 on: August 20, 2020, 01:01:53 PM »
Hi.
I think for this case you might want a different approach.
looks like the 'ChuChu Rocket' is more Grid based.

Probably using the action Move Toward or a tween.

Then best is to scale the project so that Inspectors Transform matches the grid.

So if transform would be 1,0,0 on a field, 2,0,0 would be the next field on the left.

You need to make a loop for the movement.

Maybe you could use the axis event to know what direction to go.
Then you probably need to do a raycast 1st to check if there is no wall in that direction.

If not, you can get current position (x,y or z depending the direction to go)
then use float operator to get the new position (add/subtract 1 from the current position)

then use a tween to move (float interpolate can work as well)
then loop back to the Axis event state.