WiiLi Wiki frontpage Include your post in the News Get links Hoteles Quito
WiiLi.org Forum Index WiiLi.org
a new revolution
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Wiimote FPS IR Mouselook (needs work)

 
Post new topic   Reply to topic    WiiLi.org Forum Index -> Wii Remote and Nunchuck
View previous topic :: View next topic  
Author Message
coolbho3000



Joined: 10 Dec 2006
Posts: 30

Digg It
PostPosted: Tue Jan 02, 2007 1:57 am    Post subject: Wiimote FPS IR Mouselook (needs work)

Note: I don't have my BT adapter yet so I can't even try this out.

This is an attempt to make a script that lets you mouselook in FPS games.

Basically it divides the screen into quadrants. If the cursor is in the middle, the mouse is steady. If it moves out of the middle boundary in any direction, the script moves the mouse in that direction.

The control is similar to that in Red Steel and some other Wii FPS games.

I've also included some of vkapidia's older IR mouse control code inside. If you can adapt some better IR mouse control code, then do so!

NOTE my sloppy code. Also note that this is my first GlovePIE script and I've never had the oppertunity to test this.

To start, move mouse using Wiimote to middle of screen and press HOME button. This will be difficult to do in a FPS game.

Code:

//Wiimote Mouselook GlovePIE script
//coolbho3000
//uses older wiimote mouse code from vkapidia
//please, if you can, put a better mouse script in place
//totally untested. probably sloppy. help me and check for errors.

//speed of mouse when looking
var.speed=5

//variable, turns feature on and off
var.on

if Wiimote.home
if on=0
on=1
endif
if on=1
on=0
endif
endif

//this part modified from vkapidia's mouse control script.

if on=1
if wiimote.dot1vis then
if abs(wiimote.dot1x - var.ox) > 1 then
var.cursorx = smooth(((1024-wiimote.dot1x) * Screen.Width / 1024) * 1.1 - 50, 10)
var.ox = wiimote.dot1x
endif
if abs(wiimote.dot1y - var.oy) > 1 then
var.cursory = smooth(((wiimote.dot1y) * Screen.Height / 768) * 1.1 - 40, 10)
var.oy = wiimote.dot1y
endif
endif
endif

//if feature is off, acts like basic normal mouse with right click and left click

if on=0
if wiimote.dot1vis then
if abs(wiimote.dot1x - var.ox) > 1 then
Mouse.CursorPosX = smooth(((1024-wiimote.dot1x) * Screen.Width / 1024) * 1.1 - 50, 10)
var.ox = wiimote.dot1x
endif
if abs(wiimote.dot1y - var.oy) > 1 then
Mouse.CursorPosY = smooth(((wiimote.dot1y) * Screen.Height / 768) * 1.1 - 40, 10)
var.oy = wiimote.dot1y
endif
endif
endif

Mouse.RightButton = Wiimote.B
Mouse.LeftButton = Wiimote.A

//here's the bounding box part

if on=1
//screen bounding boxes
var.topBound=(screen.height/4)
var.rightBound=(screen.width/4)*3
var.bottomBound=(screen.height/4)*3
var.leftBound=screen.width/4

//if cursor goes into bounding box range, move mouse in approprate direction
if cursorx <= topBound
Mouse.CursorPosX-=speed
endif

if cursory >= rightBound
mouse.CursorPosY+=speed
endif

if cursorx >= bottomBound
mouse.CursorPosX+=speed
endif

if cursory <=leftBound
mouse.CursorPosY-=speed
endif
endif
Back to top
View user's profile Send private message
TiagoTiago



Joined: 20 Jan 2007
Posts: 709
Location: Brasil

Digg It
PostPosted: Sun Jan 28, 2007 3:53 am    Post subject:

it ain't copiling, can I ask you to fix the stuff GPIE is compainig about?
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    WiiLi.org Forum Index -> Wii Remote and Nunchuck All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group