playMaker

Author Topic: Move opposite toward  (Read 1884 times)

mooblegum

  • Playmaker Newbie
  • *
  • Posts: 18
Move opposite toward
« on: October 13, 2020, 05:38:55 AM »
Hi,
I am looking for a way to move an object in oposite direction to the player.
It is a bonus that try to run away from the player, who will have to catch it...
So Far I tryed to :
Get the position of the player (vector3), invert the vector3, move toward with target position vector3...
Well it is not working.
The move toward the player work through so there might be a way to use the position of the player to get the opposite direction ...
Anyone help would be much appreciated!

heavygunner

  • Sr. Member
  • ****
  • Posts: 344
Re: Move opposite toward
« Reply #1 on: October 13, 2020, 06:40:32 AM »
Use minus (-) value

mooblegum

  • Playmaker Newbie
  • *
  • Posts: 18
Re: Move opposite toward
« Reply #2 on: October 13, 2020, 07:46:52 AM »
Thank you for your help again!
That is the part I don't know how to do.
There is no option in the move toward to minus the value.
The only think I could do was a vector3 invert. This not working at all.
I guess it is more complicated then that. I would need to get the direction from this object to the player and go to the opposite direction...? But I dont know how to do that.
Here is a screen of the current setup

heavygunner

  • Sr. Member
  • ****
  • Posts: 344
Re: Move opposite toward
« Reply #3 on: October 13, 2020, 09:14:51 AM »
Uncheck Invert Vertical and check

mooblegum

  • Playmaker Newbie
  • *
  • Posts: 18
Re: Move opposite toward
« Reply #4 on: October 13, 2020, 09:39:43 AM »
The checkbox is "ignore vertical", unchecking it make the object follow the vertical movement of the player.
I tried other solution in the meantime but nothing is working...

heavygunner

  • Sr. Member
  • ****
  • Posts: 344
Re: Move opposite toward
« Reply #5 on: October 13, 2020, 10:06:27 AM »
I don't understand the gameplay. Player will move in one direction ? and you want that object to move opposite to player ? currently, in which axis your player moving on ?

mooblegum

  • Playmaker Newbie
  • *
  • Posts: 18
Re: Move opposite toward
« Reply #6 on: October 13, 2020, 10:24:57 AM »
This is for a 3D platformer game.
The player can move in x and z axis and jump (like a standard platformer game)
This object is a bonus that run away from the player, the player would need to catch it before it disappear.
So instead of moving toward the player, I am looking to move it in the opposite direction.
« Last Edit: October 13, 2020, 10:26:32 AM by mooblegum »

heavygunner

  • Sr. Member
  • ****
  • Posts: 344
Re: Move opposite toward
« Reply #7 on: October 13, 2020, 10:55:24 AM »
Whenever you want to spawn bonus, raycast from player and save raycast hit info. move that bonus towards raycast hit point ?

mooblegum

  • Playmaker Newbie
  • *
  • Posts: 18
Re: Move opposite toward
« Reply #8 on: October 13, 2020, 10:58:28 AM »
Ok I will try that.
Thank you for your help!

wetcircuit

  • Full Member
  • ***
  • Posts: 158
    • wetcircuit.com
Re: Move opposite toward
« Reply #9 on: October 13, 2020, 11:01:43 AM »
Maybe get the angle to the player, and reverse that?

mooblegum

  • Playmaker Newbie
  • *
  • Posts: 18
Re: Move opposite toward
« Reply #10 on: October 13, 2020, 01:07:15 PM »
Thank you Wetcircuit. good idea. I will try that tomorrow.
I guess I need the angle or direction between the 2 GO  to move the object to the opposite.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Move opposite toward
« Reply #11 on: October 13, 2020, 01:40:02 PM »
Hi.
You can try this action i made.

Its exactly like the move toward, only it has a multiply by -1.

Now i just think of that, on the Move Toward action if you set the speed to negative that could work as well.

mooblegum

  • Playmaker Newbie
  • *
  • Posts: 18
Re: Move opposite toward
« Reply #12 on: October 13, 2020, 04:45:53 PM »
Oh holy Moly!
Thank so much Djaydino!!!
For the action you made, really appreciate it!
and then because you teach me that we can input minus values into the speed, I didn't think a second it was possible...
Both way are working, it took me 4 hours of work and it was so simple.
Really grateful about your help  :)