Game Development Community

Mapping mouse button to yaw and pitch

by Bob Larmore · in Technical Issues · 11/06/2004 (10:23 pm) · 3 replies

Does anyone know how to map the mouse in a way that yaw and pitch are on one of the buttons. I am trying to make it so icons in the gui can be clicked on using the first mouse button . The second button would be used for yaw and pitch movement. Also, how would I get the xaxis and yaxis of the mouse cursor?

Any suggestions regarding mouse button mapping would be helpful.

Thanks

About the author

Recent Threads


#1
11/10/2004 (6:55 am)
I've only been working with TorqueScript for 2-3 weeks now, and only did player movement a few days ahp but this would be done with the PlayerKeyMap, correct?

Make a function like EnablePitchYaw(%val), then set the PlayerKeyMap of button1 (this is the right button I think, if button0 is left) to execute that function.

This is what I have for the entire thing:

function DoYaw (%val)
{
$mvYaw += %val * ($cameraFOV / 90) * 0.02;
}

function DoPitch (%val)
{
$mvPitch += %val * ($cameraFOV / 90) * 0.02;
}

function NoYaw
{
}

function NoPitch
{
}

function EnablePitchYaw (%val) {
if (%val) {
PlayerKeymap.Bind(mouse. yaxis, DoYaw);
PlayerKeymap.Bind(mouse, xaxis.DoPitch);
}
else
{
PlayerKeymap.Bind(mouse, yaxis, NoYaw);
PlayerKeymap.Bind(mouse, xaxis, NoPitch);
}

PlayerKeymap.Bind(mouse, button1, EnablePitchYaw);
#2
06/09/2007 (12:18 am)
Once you figure out how to keymap, you'll have to make changesto the engine let the mouse trigger keybindings while your cursor is on. I just now posted a resource to do that but it probably hasn't been approved yet.
#3
06/10/2007 (10:22 pm)
@Dean: sounds interesting. Do you have a link to a place it can be seen? Perhaps even paste it, here?

I just tried hitting it from your profile, but as you said, it ain't there, yet.