- Home /
worldToLocale / MultiplyPoint
Hi, I have some code in a library that I'm looking to understand.
Procedure: Frame 1: Create a snapshot object that holds a reference to a transform and saves the transform.worldToLocalMatrix Some Frames ... X Frame 1+X: Uses the previously saved worldToLocalMatrix, does MultiplyPoint on the current transform.position.
The question is, what does the result of worldToLocalMatrix.MultiplyPoint do to the current transform.position? Is it possible that this returns the world position of the transform back when the worldToLocalMatrix snapshot was taken?
The code looks like:
Transform target;
Matrix4x4 worldToLocalMatrix;
void takeSnapshot(Transform transform) {
target = transform;
worldToLocalMatrix = transform.worldToLocalTransform;
}
// the transform moves over some frames
void someFramesLater() {
result = worldToLocalMatrix.MultiplyPoint(target.position);
// what is result??
}
Your answer
Follow this Question
Related Questions
How to manually calculate localToWorldMatrix/worldToLocalMatrix? 1 Answer
Building Placement Script Places Item When Switching Buildings. 0 Answers
Renderer getting disappeared from the inspector. 0 Answers
Scrolling combat text works on enemy. When I duplicate and have two enemies I get a problem. 1 Answer