I’m sorry to bother you:
I create a new node and a cube, I set the parent object of the cube to node, change the scale of node to 1,1,2, then the cube will be deformed, I set the cube to setParent(null), the cube shape is not maintained.
How do I keep the cube in shape under node?
Looking forward to your reply!
This is my PG
Hello
What exactly do you want to achieve here ? When you setParent, then the child will follow transforms of the parent. So what’s happening here is absolutely normal. (Cube following node’s transform)
If you are OK to scale the cube with the node, but your problem is the fact that it’s deformed (no longer a “cube”) it’s only due to the fact that you have set a rotation before setting parent. Which means that now, when you scale the node, the cube is scaling in an axis which is rotated, no longer aligned with the cube’s axis. Keep the cube aligned with the node if you want it to stay “cube shaped”
++
Tricotou
Thank you for your reply,
I want such a feature:
When I set a node to be the parent of a cube, I scale node, and the cube deformates because the cube inherits the scaling of node (I write this as state 1).
When I set the cube’s parent object to null, I want the cube to remain in state 1.
But now cube’s form does not hold state 1.
Ok I see. If you want the cube to remain deformed after removing parent, then what you can to is to actually apply its transform to its vertices, using bakeCurrentTransformIntoVertices
: Playground. As a result, the cube is transormed but all its transforms are 0,0,0 (1,1,1 for scaling)
1 Like