View Full Version : Function DeProject, ScreenToWorld
11-18-2009, 01:30 PM
Has anyone tried using the function DeProject?
I need to call this function or a function that can achieve ScreenToWorld calculations from within the PlayerController Class, would DeProject be the right function to use?
I tried using it and failed so far.
11-18-2009, 02:18 PM
Canvas.Project is similar to WorldToScreen and Deproject is similar to ScreenToWorld. However, remember that it converts it the screen coordinates to a world plane coordinates which is parallel to the camera near plane. Thus, you can use a trace using the Origin and Direction that it calculates and the HitLocation the trace calculates would then be your world position.
This is currently what I use for my mouse code in Project Contrast.
11-18-2009, 02:42 PM
Well I didn't get DeProject to work. I just wrote my own ScreenToWorld function.
My main problem was that I hadn't corretly grabbed the viewport size, and all my calculations were off.
Now I have 3D mouse selection.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.