Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • 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 /
avatar image
0
Question by nopesal · Nov 02, 2018 at 08:01 PM · rotation3dscaleaxiscube

¿Is it possible to scale independently of the rotation?

Hello,

I'm trying to build some kind of scaling of a Cube through a UI interaction. In this UI I have four handlers arranged on a square: top, bottom, left and right.

PowerPoint Image scaling

I'm currently scaling the object correctly detecting how much the handler has moved from the position of the first click and apply that distance to the scale of the Cube (differenceInX/Y), so if I move the right handle to the left/right, the object is scaling on the X-axis and if I move the handler on the top/bottom the object is scaling on the Y- axis. I'm doing this using localScale this way:

 mCube.transform.localScale = new Vector3(localScale.x + differenceInX, localScale.y, localScale.z);

My problem starts when I apply a rotation to the Cube, because I want to still resize my Cube to the right if I move the right handler, but, for example, if my Cube is rotated 90º on Z axis, the axis at the right side of the Cube is -Y, not X anymore. This also applies to a rotation in Y, for example, with a rotation of 90º in Y the axis at the right side is -Z.

So I thought of changing the resize axis depending on the range of rotation the object has, but because rotations can be applied freely, I don't know how to control ranges of accumulated rotations in multiple axes. I think I may be missing something that can make this easy.

I ask if someone knows how can I scale an object always to its top/bottom/left/right side without taking care of the rotation. If a Cube is rotated in multiple ways, if I move the right handle I want to scale its right side from my point of view.

Thank you very much and I hope I explained it well.

boceto.png (9.5 kB)
Comment
Add comment · Show 2
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 hexagonius · Nov 02, 2018 at 09:18 PM 1
Share

do everything locally. my suspicion is that you are not transfor$$anonymous$$g the mouse coordinates into the cubes space. use cube.transform.InverseTransformPoint(mouse.position) (pseudocode) to get the mouse in its local space, do all your calculations there

avatar image nopesal hexagonius · Nov 03, 2018 at 06:02 PM 0
Share

It works!! I needed just to know that, now I can finally detect where to move my Cube. Thank you very much!

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

142 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 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 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 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 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 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 lock a transform's local up axis rotation on any surface 1 Answer

How to leave bevels of an object (created in Blender) as they was created? 1 Answer

LookAt() with X axis 1 Answer

how to only get the negative or positive part of a GetAxis 1 Answer

Rotate cube in two direction not working 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