Well I guess I misread initially. The current behavior is actually correct
I do not understand why you need to ++ on the updateFlag afterwards as the matrix flag must have changed after the copy (to match the source one)
Well I guess I misread initially. The current behavior is actually correct
I do not understand why you need to ++ on the updateFlag afterwards as the matrix flag must have changed after the copy (to match the source one)
If _markAsUpdated() is called after calling toArray(entityMatrix.m) to directly alter the values, then the flag would be properly changed. I think making that public could be a good solution.
Unless you took for granted that the updateFlag was unique?
I can make it public, no problem at all. But @bghgary convinced me we should not call it automatically as it is expected to have the same flag as the contents are the same
It should only be called automatically by the methods of Matrix that cause the m array to change I think, that way you can test the flags to see if the m values have changed?
The problem is this line. This will update the matrix array directly without updating the updateFlag.
not this one as we want to keep the if (a.updateFlag === b.updateFlag) then we know they are the same
That’s why I’m saying to change it whenever the matrix values are changed…
Yep, exactly, and I said that a few times as well. I’m gonna bow out and let you guys figure this one out, we’re kinda talking around each other in circles I think LOL.
Is this user code?
Lol yes
So to summarize: we are going to expose the markAsUpdated function
When you call toArray you will have to manually call the markAsUpdated as we cannot do it from the toArray function
entity.worldMatrix.toArray(entityMatrix.m)
entity.worldMatrix.toArray
is a method in your code, not in Babylon. So it’s your responsibility to update the updateFlag
of the entityMatrix
because you know you are going to update the values. If possible, I think you should pass entityMatrix
instead of entityMatrix.m
to toArray
and let your toArray
method update the updateFlag
(thanks to the new public markAsUpdated
method).
@Deltakosh it’s still a breaking change, as outlined by this thread, even if I think it can be labeled as a bug in 4.2 (the updateFlag
was updated too often, even when the matrix values did not change). Maybe a line should be dropped in the Breaking change
section about this?
Totally. @bghgary will take care of mentioning it
What did I start?
Thank you guys!