playMaker

Author Topic: Negate a vector coordinate [SOLVED]  (Read 3274 times)

HeathClose

  • Full Member
  • ***
  • Posts: 226
Negate a vector coordinate [SOLVED]
« on: January 11, 2017, 04:45:47 PM »
I have an fsm spawning a game object at random points...

it stores that location.. for example... -1.4, 133, 0

this is a 2d game, so i want that object to now tween along the x axis... for example...

ping pong from -1.4, 133, 0 (where it spawned) and 1.4, 133, 0

is there a way to use an action to get the location to tween to as a negative of the x coordinate?

I tried using this...



but that just breaks the syntax and makes it all 0,0,0... (pic not of runtime... i know there isn't a string to change it to in the pic but I get a variable at runtime)

How could I do this?
« Last Edit: January 14, 2017, 03:25:36 PM by HeathClose »

jrock84

  • Playmaker Newbie
  • *
  • Posts: 23
    • Divergent Worlds Interactive
Re: Negate a vector coordinate
« Reply #1 on: January 11, 2017, 09:00:31 PM »
If I'm not mistaken, you can just multiply your variable with vector multiply and that should get it.

HeathClose

  • Full Member
  • ***
  • Posts: 226
Re: Negate a vector coordinate
« Reply #2 on: January 11, 2017, 09:58:07 PM »
If I'm not mistaken, you can just multiply your variable with vector multiply and that should get it.

Awesome... i didn't know that was a thing... thank you...

when I multiply the vector 3 by -1... it multiplies them all by -1, so instead of tweening along the x axis and it's negative... it also tweens to the y axis negative... and I only want to multiply the x by -1...

jrock84

  • Playmaker Newbie
  • *
  • Posts: 23
    • Divergent Worlds Interactive
Re: Negate a vector coordinate
« Reply #3 on: January 11, 2017, 10:56:25 PM »
Which itween action are you using for your movement?

HeathClose

  • Full Member
  • ***
  • Posts: 226
Re: Negate a vector coordinate
« Reply #4 on: January 12, 2017, 11:34:28 AM »
Which itween action are you using for your movement?

itween move to set to ping pong

jrock84

  • Playmaker Newbie
  • *
  • Posts: 23
    • Divergent Worlds Interactive
Re: Negate a vector coordinate
« Reply #5 on: January 12, 2017, 12:10:15 PM »
Take a look at Set Vector3 XYZ. You can 0 out your other two values and leave your X axis unchanged.

HeathClose

  • Full Member
  • ***
  • Posts: 226
Re: Negate a vector coordinate
« Reply #6 on: January 12, 2017, 05:48:16 PM »
Take a look at Set Vector3 XYZ. You can 0 out your other two values and leave your X axis unchanged.

thanks for that idea!

I need to retain my y axis, that one won't work for me

jrock84

  • Playmaker Newbie
  • *
  • Posts: 23
    • Divergent Worlds Interactive
Re: Negate a vector coordinate
« Reply #7 on: January 12, 2017, 10:04:28 PM »
It's configurable. You can alter any of the vectors and keep whatever you want, unless I'm misunderstanding you.

HeathClose

  • Full Member
  • ***
  • Posts: 226
Re: Negate a vector coordinate
« Reply #8 on: January 14, 2017, 03:25:17 PM »
It's configurable. You can alter any of the vectors and keep whatever you want, unless I'm misunderstanding you.

OK!  thank you ... so your help lead me to the solution indeed...

first.. get vector3 xyz and store those values

second... float multiply (the x by -1)

third... set vector3 xyz

Bob's your uncle...

thank you!

jrock84

  • Playmaker Newbie
  • *
  • Posts: 23
    • Divergent Worlds Interactive
Re: Negate a vector coordinate [SOLVED]
« Reply #9 on: January 14, 2017, 03:27:22 PM »
Happy to help!