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 

RotMat in GlovePie, or: Rotating around Global-Axes

 
Post new topic   Reply to topic    WiiLi.org Forum Index -> GlovePie
View previous topic :: View next topic  
Author Message
carjacker



Joined: 01 Apr 2008
Posts: 3

Digg It
PostPosted: Tue Apr 01, 2008 11:56 pm    Post subject: RotMat in GlovePie, or: Rotating around Global-Axes

Hi,
I'm a German student in grade 12 and working on a project about the Wii in connection with the PC.
Maybe my English is not the very best but i hope u'll understand me Laughing
So my problem now is following:
I've got a cube i want to turn in every direction. But I can't use roll, pitch and yaw, because u always see the cube from the front an u can "grab" it with the wiimote an turn in. But if i just change the pitch, yaw and roll the cube rotates around his own axes.
So my idea is not to rotate the cube but move the camera around the cube. But i need alway to focus on the cubes center, that it seems like the cube is rotating.
Anybody who knows how to do that, like use a Rotation Matrix or anything else, and is able to explain it to me Very Happy????

Would be nice!

cheers
carjacker
Back to top
View user's profile Send private message
carjacker



Joined: 01 Apr 2008
Posts: 3

Digg It
PostPosted: Wed Apr 02, 2008 2:24 pm    Post subject:

No ideas?
Hm...
But maybe s.b. knows how to use cam.WalkLeftDir properly.
I did it like this:
Code:

cam.pos   += Cam.WalkLeftDir *0.04
cam.pos   += Cam.WalkFwdDir *0.04
cam.yaw += 0.03666

So the camera moves around the cube like in a circle with r=5 meters.
Is it right that Cam.WalkLeftDir moves the Camera left along its own X-Axis and not along the global X-Axis??
I really need ur help! The project is to be finished at the 14th April

Thanks!

carjacker
Back to top
View user's profile Send private message
crim3



Joined: 30 Jan 2008
Posts: 26
Location: Spain

Digg It
PostPosted: Thu Apr 03, 2008 1:08 pm    Post subject:

Can the cam.WalkFwdDir vector be set? If so, you could make the camera look to the cube setting it to the cube position after the rotation.
Have you already tried RotMat? I've never used it so I don't know how it works. I'd like to test it but I can't run glovepie on this computer.
Back to top
View user's profile Send private message
crim3



Joined: 30 Jan 2008
Posts: 26
Location: Spain

Digg It
PostPosted: Thu Apr 03, 2008 5:42 pm    Post subject:

I'm at home now and I've tried it. The camera and object coordinates are independent. It's not possible to do the WalkFwdDir thing.

And also... I'm re-reading your post, and I think I don't get it. Moving the camera around the cube looking at the cube is the same that rotate the cube itself.
What inputs do you want to use to control the cube's position/orientation?
Back to top
View user's profile Send private message
carjacker



Joined: 01 Apr 2008
Posts: 3

Digg It
PostPosted: Fri Apr 04, 2008 2:27 pm    Post subject:

Hi!
Thanks for answers.
I already realized that the "WalkFwd thing" does not work, too.
I'm using the wiimote as input device and want to move the cube by finger tracking.
My code looks like that:
Code:

obj1.size= [0.8,0.8,0.8]
Obj1.colour = [100%, 0%, 30%]
var.smooth = 0.00001
//Position  dot1
var.x2 = wiimote.dot2X
var.y2 = wiimote.dot2y



if wiimote.dot2vis = false then
   var.x1 = Wiimote.dot1x
   var.y1 = Wiimote.dot1y
end if

//rotate right
if (wiimote.dot1vis) and (wiimote.dot2vis) and (var.x2 > var.x1+30) then
   obj1.yaw = obj.yaw + (sqr(var.x2 - var.x1) *var.smooth)
end if
// rotate left
if (wiimote.dot1vis) and (wiimote.dot2vis) and (var.x2 < var.x1-30) then
   obj1.yaw = obj1.yaw - (sqr(var.x2 - var.x1) *var.smooth)
end if
// rotate up
if (wiimote.dot1vis) and (wiimote.dot2vis) and (var.y2 > var.y1+30) then
  obj1.pitch = obj1.yaw + (sqr(var.y2 - var.y1) *var.smooth)
end if
//rotate down
if (wiimote.dot1vis) and (wiimote.dot2vis) and (var.x2 < var.x1-30) then
   obj1.pitch = obj1.yaw - (sqr(var.y2 - var.y1) *var.smooth)
end if


debug = 'X=' + var.x1 + ' Y=' + var.y1 + ' X2=' + var.x2 + ' Dif=' + (var.x2 - var.x1)
//by Hannes Speicher alias carjacker

This is now with a rotating cube and not with a moving camera.

I know that moving the camera and let the cube rotate is the same. But obj and cam can be moved and rotated different.
So I try to figger out the best and easiest way.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    WiiLi.org Forum Index -> GlovePie 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