You are not logged in.

#1 2010-12-12 17:19:50

owen
Member

3d vs 2d ir cursor

I'm building a shooter in GRRLIB wii and currently I'm rendering the IR pointer as 3d cube in 3d space using some rough calculations.  problem is when I shift the camera's orientation I lose the cursor and it has become a real pain to keep it on the screen.  Sometimes the camera is looking at a point which is at an angle.  Should I just use a 2d Cursor sprite or is there a easy way to translate the IR coords into a 3d point relative to the camera?

Offline

 

#2 2010-12-13 04:16:09

mdbrim
Member

Re: 3d vs 2d ir cursor

the ir coords aren't at a 3d space... they point to a spot on the 2d plane of the screen.  Now, the camera can tell how far it is from the screen, hence you get a z type coordinate, but as far as plotting the ir in 3d space, you would not know where it was in the plane of the screen (depth)

picture a laser pointer shooting into the screen... the "pointer" would be anywhere on that laser all the way to infinite.

Now you could set the "depth" by defining the "laser" at a specific length... ie the pointer is always fixed to the end of a stick on the wiimote... push the wiimote closer to the screen and the pointer goes deeper into the image, pull it back and it gets closer to the screen.  but you would just need to alter the distance from the screen variable and to some math to make it sit where you wanted it in space.

Offline

 

#3 2010-12-13 20:39:34

owen
Member

Re: 3d vs 2d ir cursor

@mdbrim  I use the player as a point of reference and the target is a fixed distance away from the player but anyway I decided not to bother with the angled cameras for now.  I figure its not worth it until I get more of the important stuff in the game complete (like a level and a boss).  Plus it was annoying me as all hell.  So now I have the player character fixed in the center of the screen by having the camera follow directly behind the player at all times.  This is adequate for most use cases but not optimal for a flying game on rails.  Maybe at some point in the future I will come back and try to get it working.

Offline

 

#4 2010-12-14 14:30:07

mdbrim
Member

Re: 3d vs 2d ir cursor

sweet, yeah that's what i would do as well...

Now i see what you were saying about the pointer leaving when you rotate camera.

when you shift the camera's orientation you would have to also shift the "base" of the pointer by that much also.. plus do some trig to adjust the pointers position in space (because what was x and y on the ir corrds is now z and y when you shift 90 degrees on the camera viewpoint)  that's why you lose site of it.

Offline

 

#5 2010-12-14 15:58:05

owen
Member

Re: 3d vs 2d ir cursor

Yeah, it works fine when dead centered but drift too far off to the left/right and its unusable.  Its a small part of my gameloop either way so I can work on it later.  I was trying to emulate the sfox  target system, it may take more work than I had originally thought before I get it correct.
eitherway thanx for your input.

Last edited by owen (2010-12-14 15:58:53)

Offline

 

Board footer

Powered by FluxBB