• 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
1
Question by Mac70 · May 06, 2015 at 05:53 PM · c#gameobjecttransformmath

Shear transformation using GameObject transformations

Is it possible to create shear transformation (for 2 or at least 1 axis) using cascade of GameObject transform operations?

I know that t$$anonymous$$s is possible to do using Mesh API or proper shader, but I would like to know if the same effect can be ac$$anonymous$$eved using only plain GameObjects and some scripting instead.

Comment
Add comment
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

· Add your reply
  • Sort: 
avatar image
4
Best Answer

Answer by Trejkaz · Jun 20, 2018 at 09:35 AM

It can be done. Example:

  • Outermost game object: Rotation X=22.5, Y=0, Z=0

  • Next game object in: Scale X=1, Y=0.3826834, Z=0.9238795

  • Next game object in: Rotation X=-45, Y=0, Z=0

  • Next game object in: Scale X=1, Y=2, Z=1.414214

  • Standard unit cube inside that.

Produces a 45 degree shear on X:

Screenshot

The general case:

  • Rotate by X=theta/2 counter-clockwise

  • Scale by Y=sin(theta/2), Z=cos(theta/2)

  • Rotate by X=45 degrees clockwise

  • Scale by Y=sqrt(2)/sin(theta), Z=sqrt(2).

You can probably reduce that to two game objects but I left it as 4 to illustrate how many transformations are being done.


shear.png (21.0 kB)
Comment
Add comment · Show 1 · 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 theNfan · Sep 07, 2022 at 03:28 PM 0
Share

I know this is old, but I really don't see how you got to these numbers with these formulas.

A simpler method can be found here: https://twitter.com/MajorMcDoom/status/1231447166092054528 Simply nest the object to shear in another, rotate the outer one way, rotate the inner another way, scale the outer object, boom!

avatar image
-1

Answer by steakpinball · May 06, 2015 at 05:56 PM

No. Transforms can only translate, rotate, and scale. Combining those operations never produces shear. You will have to use somet$$anonymous$$ng else to produce shear.

Comment
Add comment · Show 2 · 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 Trejkaz · Jun 20, 2018 at 09:35 AM 0
Share

Or you could use game objects and rotations and scaling. Example in my alternative answer.

avatar image Bunny83 · Jun 20, 2018 at 10:08 AM 1
Share

This answer is only true if you only use a uniform scale. If you have a non-uniform scale it can produce a shear

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

6 People are following this question.

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

Related Questions

How to keep a Gameobject in the same position after a transform.Rotate? 2 Answers

How can i get ONLY the childrens of a GameOnbject with GetComponentsInChildren method? 5 Answers

Affine transformations to Object 3 Answers

How would you fake air resistance? (c#) 2 Answers

Transforming a GameObject with an unattached script 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