- Home /
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 this is possible to do using Mesh API or proper shader, but I would like to know if the same effect can be achieved using only plain GameObjects and some scripting instead.
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:
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.
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 something else to produce shear.
Or you could use game objects and rotations and scaling. Example in my alternative answer.
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
Follow this Question
Related Questions
How to keep a Gameobject in the same position after a transform.Rotate? 2 Answers
How to Reverse an equation.. (c#) 2 Answers
How can i get ONLY the childrens of a GameOnbject with GetComponentsInChildren method? 5 Answers
Affine transformations to Object 3 Answers
Transforming a GameObject with an unattached script 1 Answer