-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using Camera.WorldToScreenPoint with SyphonServerCustomResolution #5
Comments
I've recently had to deal with similar issues myself. the issue is, you need to be able to
In SyphonServerTextureCustomResolution, if you take a look, I was using OnGUI to do this drawing to the screen, but really, you should probably use a second camera (or soon, the new gui system) to achieve this. I've tested doing this with the new (beta) gui system, and it works fine. If i were you, i'd simplify SyphonServerTextureCustomResolution-
Once the new gui system is released, I'll probably switch over to that method for an official release, as it is a quick and easy way to achieve this. |
This is an old issue but I'd like to add my two cents. I had a similar issue as well (Camera.main.ScreenPointToRay) when using the SyphonServerCustomResolution script. In a main script I store a reference to the main camera on the Awake() method. That way you'll have that reference after SyphonServerCustomResolution disables the component.
Usually Camera.main.pixelWidth/pixelHeight will have the same dimensions as Screen.width/height but in the case of SyphonServerCustomResolution the factor between these will become variable. I kept this x/y factor stored in a Vector2 and recalculate Input.mousePosition by this factor.
Now, when doing a Physics.Raycast, instead of
we do this
This worked wonders for me. I don't know if this is a crude method but it may help others. |
@bombarie s way seems to be the way to go. I had some issues with the code as is. This is what I did differently
|
Hi Brian,
Wondering what the best way to accomplish passing mouse position while the custom resolution output script is implemented. With a regular Syphon server running, I am still able to use Camera.WorldToScreenPoint, but as soon as I activate the custom resolution script instead, I get a NullReferenceException. Is there a new camera that I can call?
Thanks!!
-Mike
The text was updated successfully, but these errors were encountered: