- Home /
How to replicate renderer.worldToLocalMatrix
The doc for the transform.worldToLocalMatrix (http://docs.unity3d.com/ScriptReference/Transform-worldToLocalMatrix.html) says to use the renderer version. I assume this because the renderer code take care of setting up your matrix correctly depending on what platform/api you are on. Is there a function to replicate that functionality without having to resort to a renderer component? Thanks.
Transform.worldToLocal$$anonymous$$atrix is perfectly usable. The documentation just says to use the renderer equivalent ins$$anonymous$$d when setting shader parameters.
I am using it to set shader parameters. (The transform is from a different object without a renderer component)
I'd added a similar question a few days back. Using transform.worldToLocal$$anonymous$$atrix
works fine -- just remember it's column major, so use post multiply in your shader. It works on DX and Webplayer (GL) for me, so I think it's fine.