Need some help with code


RE: Need some help with code
#4
(2023-04-04, 21:30)Max Murtazin Wrote: I do use both Vector3 and Matrix4x4 already

You also create matrices with what looks like a single vector filled in (tmp) and then extract the vector from the multiplied result.

It's also not clear from the code how you accumulate the matrices. I would just keep a function parameter for the current accumulated transform. Each line type 1 would be a recursive call that passes the current transform multiplied by that line's transform to the function. When you see a vertex, multiply it by the current transform parameter.

It's possible to use a method that modifies the matrix field or property like what you have, but it's easy to forget to "reset" the transform when leaving a subfile. It helps to draw a tree on paper or work with a simple file with only a few pieces. A parent file's transforms affect its children, but the child transforms should not affect other files at the same depth in the tree. The function recursion will handle the case where a file has multiple subfile references.
Reply
« Next Oldest | Next Newest »



Messages In This Thread
Need some help with code - by Max Murtazin - 2023-04-04, 19:26
RE: Need some help with code - by Jonathan N - 2023-04-04, 21:02
RE: Need some help with code - by Jonathan N - 2023-04-04, 22:26
RE: Need some help with code - by Jonathan N - 2023-04-04, 23:50

Forum Jump:


Users browsing this thread: 2 Guest(s)