Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Fun little 3D space question which is not hard at all

Author
Message
basicFanatic
6
Years of Service
User Offline
Joined: 7th Jun 2017
Location:
Posted: 17th Oct 2018 18:16
In Virtual Reality, I'm trying to position a 3D plane at the exact physical position of my monitor. The end goal is to be able to use my Touch controller as a light gun which can shoot targets on my physical monitor.

Before playing, the player has to record the position of their screen in VR space. I figured the smartest way to do this is to use the Touch controller to record the four corner points of the monitor. Surprisingly, this worked.

So then I had four XYZ positions representing the four corners.
I have found the length of the screen by calculating the length between the upper-right and upper-left corner, using GetVector3Distance()
Likewise with the height of the screen.
And the screen's location seems to just be the average of the four corners.

But wait, how do I figure out the screens angle?
I have the XYZ position of each of the four corners. So I got plenty of data. But how exactly do I extract an angle from that?

And then ... I have to figure out how to shoot a ray from the Touch controller towards the plane, and convert the hit position to the XY position on my monitor.
Again, I got plenty of data, but I'm afraid I have to use math here. Trigonometry, the worst math! Help!
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 17th Oct 2018 21:38 Edited at: 17th Oct 2018 21:39
If I am understanding your problem correct if you know your monitors coordinates in the real world and you want to be able to shoot
a gun at it (heaven forbid oh you mean light gun) I believe you want to place an object in the VR 3D space at the exact location of the
monitor.

The rotation vectors should be able to be calculated from the following command

if you want to orientate an object use GetRawRotationX etc

not sure if thats much help but very curious how you go and it sounds like a great idea for a game
maybe with helloween coming up zombies
fubar

Login to post a reply

Server time is: 2024-04-25 22:21:16
Your offset time is: 2024-04-25 22:21:16