|
Post by aholla on Dec 3, 2021 6:44:18 GMT
HI I would like to move items between layers.
When I do this, the objects positions jump as they are now being rendered by a different camera.
Does anyone know how i can move the item to a new layer but position it so that it looks like nothing has changed.
As I write this, im guessing something like gettings the screen position based on the current camera and then applying that to the new camera...
|
|
|
Post by Luís Pedro Fonseca on Dec 3, 2021 22:42:59 GMT
aholla That's a good question, but I don't think there's a built-in way to do that currently. I can look into adding that helper method but I can't give you an estimate of when I could do it.
|
|
|
Post by aholla on Jan 4, 2022 13:01:45 GMT
I ended up using the method below and providing the two cameras that needed swapping.
private void ConvertBlobCameraPosition(GameObject blobGO) { var fgPos = _camForeground.WorldToViewportPoint(blobGO.transform.position); fgPos.z = -_camForeground.transform.position.z;
var mdPos = _camMid.ViewportToWorldPoint(fgPos); blobGO.transform.position = mdPos; }
|
|