[sldev] 3D mice / joystick support in Build mode
Ettore Pasquini
ettore_pasquini at 3dconnexion.com
Tue May 29 16:36:12 PDT 2007
I am working to support 3D mice and joysticks in Edit (Build) mode so that
the selected objects can be moved and rotated directly using the device with
no keyboard/mouse intervention required. I am stuck at the problem explained
below. I added 2 methods to LLSelectMgr:
void LLSelectMgr::selectionRotateOneUpdate(F32 rx, F32 ry, F32 rz)
{
LLQuaternion rotx( rx * DEG_TO_RAD, LLVector3(1,0,0) );
LLQuaternion roty( ry * DEG_TO_RAD, LLVector3(0,1,0) );
LLQuaternion rotz( rz * DEG_TO_RAD, LLVector3(0,0,1) );
LLQuaternion rot = rotx * roty * rotz;
LLViewerObject* object;
for (object = mSelectedObjects->getFirstRootObject(); object;
object = mSelectedObjects->getNextRootObject() )
{
object->setRotation( object->getRotationEdit() * rot );
if (object->mDrawable.notNull())
{
gPipeline.markMoved(object->mDrawable, TRUE);
}
object->sendRotationUpdate();
}
}
void LLSelectMgr::selectionPosition(const LLVector3& displ)
{
LLViewerObject* object;
for (object = mSelectedObjects->getFirstRootObject(); object;
object = mSelectedObjects->getNextRootObject() )
{
object->setPositionEdit( object->getPositionEdit() + displ);
if (object->mDrawable.notNull())
{
gPipeline.markMoved(object->mDrawable, TRUE);
}
object->sendPositionUpdate();
}
}
My problem is that the motion I get is choppy (or at best, it's fluid for
less than a second). I do obtain better (not perfect but acceptable) motion
when only one degree of freedom is involved.
I am calling the above methods from the main_loop when some activity from
the device has been detected, basically right after the scanJoystick() call
in viewer.cpp. Is this correct? I know the mouse input is handled very
differently and I am not sure I understand how. What would be the
recommended way to handle this?
I am not sure where exactly I should place my methods into the event/message
architecture already in place, so any advice would be much appreciated.
Thanks in advance,
Ettore
More information about the SLDev
mailing list