• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed Dec 11, 2014 at 07:06 PM by DarkSlash for the following reason:

The question is answered, right answer was accepted

avatar image
Question by DarkSlash · Dec 05, 2014 at 09:59 PM · movementitweenmovetowardsplaymaker

Playmaker: How to use transform.position in actions

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 Towards, 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?

Comment

People who like this

0 Show 0
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

  • Sort: 
avatar image
Best Answer

Answer by DarkSlash · Dec 11, 2014 at 07:05 PM

I have to do 3 actions, like in programming, but using Playmaker actions:

0) Create a Vector3 variable

1) Get the position an store it in the Vector3

2) Add to that vector -2 with the action Add Vector3 XYZ

3) Do a Move To the Vector3 variable that we created

Comment

People who like this

0 Show 0 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image

Answer by M-G-Production · Dec 05, 2014 at 10:12 PM

Hi DarkSlash!

When you say move to "0,-2,0", you set absolute values wich are relative to the scene "grid".

In your case, you must make it relative to the object!

So There it is in C#:

 transform.position = new Vector3(transform.position.x,transform.position.y - 2, transform.position.z);

Bests, Math

Comment

People who like this

0 Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image DarkSlash · Dec 05, 2014 at 10:36 PM 0
Share

Of course that is the correct way, but I want to put that in the Playmaker action panel :)

avatar image DarkSlash · Dec 05, 2014 at 10:36 PM 0
Share

And I want to move the object to y = -2, not to transform.position. y - 2; )

avatar image M-G-Production · Dec 05, 2014 at 11:00 PM 0
Share

I'm sorry, I did not know about Playmaker visual scripting,

If you want Y to be absolute -2, I'm pretty sure you know how!

(ok ok... transform.position = new Vector3(transform.position.x,-2, transform.position.z); )

I can't help you more with Playmaker... But anyway, I tried to help!

Update about the future of Unity Answers

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta later in June. Please note, we are aiming to set Unity Answers to read-only mode on the 31st of May in order to prepare for the final data migration.

For more information, please read our full announcement.

Follow this Question

Answers Answers and Comments

26 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to make vehicles move in forward AND reverse using a touch to move system 0 Answers

Itween CRSpline to BezQuad 2 Answers

How good is to put Move.Towards on Fixed Update? -1 Answers

Make object jump to fixed y position 1 Answer

How do i add velocity in direction depending on WASD keys pressed 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges