playMaker

Author Topic: Use transform.position in Actions  (Read 3494 times)

DarkSlash

  • Playmaker Newbie
  • *
  • Posts: 9
Use transform.position in Actions
« on: December 05, 2014, 04:54:36 PM »
I want to move and object to an Y position, but NOT on the X axis, just in the Y. Lets say, I want to move it to y = -2. If I use an iTween MoveTo and put the Vector3 as 0,-2,0, the object moves to x = 0  too. If I use Move Torwards, I can set the target position, but I need to put in the X textbox something like transform.position.x to leave the X position as it is. How this is done?
« Last Edit: December 05, 2014, 04:57:30 PM by DarkSlash »

Phuzz

  • Full Member
  • ***
  • Posts: 101
    • Bzilla Games
Re: Use transform.position in Actions
« Reply #1 on: December 07, 2014, 01:31:06 AM »
You can try and set the position to "Self" and not "World", and when you put the transform locations put 0 where the X is.
Bzilla Games "Education with a Tickle!"
Qbucket Games "Voxel Games"

DarkSlash

  • Playmaker Newbie
  • *
  • Posts: 9
Re: Use transform.position in Actions
« Reply #2 on: December 08, 2014, 07:35:11 AM »
If I do that, the object will move to -2 y from its own position. I want to every object moves to the world y = -2! But remaining in their current x!

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Use transform.position in Actions
« Reply #3 on: December 08, 2014, 08:11:15 AM »
Get the position, then add the vector you want, then tween to that new vector.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

DarkSlash

  • Playmaker Newbie
  • *
  • Posts: 9
Re: Use transform.position in Actions
« Reply #4 on: December 08, 2014, 08:15:13 AM »
Sorry, beginner down here! Can you be more specific? Thanks! :)

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Use transform.position in Actions
« Reply #5 on: December 08, 2014, 08:27:52 AM »
iTween Move By is basically this, iirc, but otherwise...

You can use Get Position to grab the current position of the Object, say this is something like ( 20.23, 15, 19.8 ).

Now how much do you need to move it and in which direction? Make a vector that is that value, like (0, -2, 0).

Now add the two together, save it in a variable and that is your new position target, Tween to that. In this example it would be ( 20.23, 13, 19.8 )

« Last Edit: December 08, 2014, 08:29:23 AM by Lane »
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

DarkSlash

  • Playmaker Newbie
  • *
  • Posts: 9
Re: Use transform.position in Actions
« Reply #6 on: December 08, 2014, 08:29:35 AM »
Ok! Got it! The issue is that I don't need to move it -2 in the y direction... I need to move it until y = -2 in worldspace!