Jump to content
Igor Q.

Raycasting - Camera Direction

Recommended Posts

Hi

I'm trying to use Raycasting from the Camera of the player.

However there is a problem.

The "Camera Ray Direction" is by default linked to the screen of the user(0,0 being bottom right, and 1920x1080 being top/right for the average PC user).

image.thumb.png.aa5d2b500fc539eed8643089d6a3603e.png

This means depending on the screen resolution of the user, it will be different for each player.

Please implement a math shortcut to convert an Angle Vector, to a Directional Vector. (Solution provided below)

image.thumb.png.e8828811eff49227713d61017634d387.png

 

Share this post


Link to post
Share on other sites

Hello Igor,

you can use these two tiles to get the current screen size of the client. That should allow you to get the center of the screen of every screen.

Hope that helps :)

 

2022-03-16_13h39_13.png

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

@pypse
Hey, thanks for the reference, however it still doesn't resolve the issue with different screen formates.

I'm using a monitor that's 2560x1440, so whatever measurements I use,  it won't work for the average user. (1920x1080)

I understand what you mean now, thanks!

Edited by Igor Q.
  • Upvote 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×