[Question] Projecting 3D Space to 2D Space (similar to Project() function in UDK)

Hello,

I’m currently doing a marquee/selection box found in RTS. In UDK there is a project() function that transform 3D space into 2D space. Are there any similar functions found in Rocket?

Thanks

Link to UDK Canvas Technical:UDK | CanvasTechnicalGuide

Dear Lim,

Yes there is such a function!

You will need to be using your own custom HUD class to use it, and you must call it from within DrawHUD

it is

if(Canvas)Canvas->Project()

and

if(Canvas) Canvas->Deproject()

#Canvas.h

Refer to the Canvas.h file in your main Rocket install Source folder for more info, you should get used to refering to these .h files

/** Transforms a 3D world-space vector into 2D screen coordinates. */
	FVector Project(FVector Location);

	/** 
	 * Transforms 2D screen coordinates into a 3D world-space origin and direction.
	 * @param ScreenPos - screen coordinates in pixels
	 * @param WorldOrigin (out) - world-space origin vector
	 * @param WorldDirection (out) - world-space direction vector
	 */
	void Deproject(FVector2D ScreenPos, /*out*/ FVector& WorldOrigin, /*out*/ FVector& WorldDirection);

#Windows Grep
I recommend using something like windows grep to make searches easier

It’s free and is independent of Visual Studio

Rama

Hello Rama,

I did a search in the Source folder and found 2 Canvas.h but i managed to find the Project() one under the Engine folder. Thanks for your help and the Wingrep recommendation. :smiley:

Thanks