Question by
toto22x · Apr 25, 2016 at 08:11 PM ·
transformmeshchilddeformation
How to prevent my mesh from being distorted when set as a child?
Hi,
I have a script (in JS) that I put on an empty game object. The script creates a mesh at the exact position/rotation of the empty object, and it works fine.
// Create the new mesh
var mesh = GameObject();
// Initialize the mesh
// Like: vertices, uvs, triangles, ...
// Put it at the same spot as the empty game object
mesh.transform.position = transform.position;
// Then edit the position of some points of the mesh in update()
However I'd like the mesh to be a child of the empty game object. So I add this line:
mesh.transform.parent = transform;
It works, except that now the mesh is a little distorted...
Any idea how to fix this? Thanks!
Comment
Your answer
Follow this Question
Related Questions
Making a realistic breaking wave 0 Answers
Cartoon Motion Blur 0 Answers
Child transform same as parents transform 1 Answer
Please help with transform child rotation 0 Answers
Why Game Object deform in here? 0 Answers