Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
I'm trying to work on my morphing algorithm. How can I copy one buffer into another buffer please ? say I have two meshes and I want to copy the tempMeshBuffer into the currentMeshBuffer in this example... currentMeshBuffer.Vertices = tempMeshBuffer.Vertices; Am I doing that right ? It doesn't seem to be working the way I want it to. What I want is for currentMeshBuffer to be altered to match tempMeshBuffer. |
||||
|
I must add that the once one mesh has been duplicated they have to be totally independent of each other. I tried the method above and I also tried createClone()... when I do that, if I change one mesh it also changes the other one ! Thanks for any guidance :) |
||||
|
If you assign the vertices like the one above, then both point to the same array, meaning that if you change one, the other one also changes, because it is actually the same, yes :) You are right, when calling MeshBuffer::createClone(), a new array is created, but actually the same vertices are used. Will be fixed in the new release (about two weeks away). You can fix this yourself, by adding this code and overwriting the wrong implementation in the meantime: CL3D.MeshBuffer.prototype.createClone = function() |
||||
|
Great I will try the clone fix for now, thank you very much :) |
||||
|
This works well. One bug in it, these lines needs to be capital X and Y or you lose the textures : v.TCoords = new CL3D.Vect2d(vold.TCoords.x, vold.TCoords.y); Needs to be : v.TCoords = new CL3D.Vect2d(vold.TCoords.X, vold.TCoords.Y); Then it works. |
|