Crystal Space - Mouse Movement

Started by
4 comments, last by acraig 19 years, 5 months ago
im trying to make objects selectable in my program, the crystal space manual shows you how to pick the object based on the camera and the co-ordinates of the mouse but i have no idea what function to call to get this, thanks alot (also if anyone knew the api references for input capture id be very greatfull)
http://stowelly.co.uk/
Advertisement
Here's a bit of our camera class that figures out what mesh is at the current mouse coords:

iCamera *psCamera::GetICamera(){    return view->GetCamera();}iMeshWrapper* psCamera::FindMeshUnder2D(int x, int y){    if (!GetICamera())        return NULL;    csVector3 vc, vo, vw;    csVector2 perspective( x, GetICamera()->GetShiftY() * 2 - y );    GetICamera()->InvPerspective( perspective, 1, vc );    vw = GetICamera()->GetTransform().This2Other( vc );    iSector* sector = GetICamera()->GetSector();    if ( sector )    {        vo = GetICamera()->GetTransform().GetO2TTranslation();        csVector3 isect;        csVector3 end = vo + (vw-vo)*600;        iMeshWrapper* sel = sector->HitBeamPortals(vo, end, isect, NULL);        return sel;    }    return NULL;}
thanks alot, are there any other sites apart from the actual crystal space one that are good for information about it
http://stowelly.co.uk/
Ah if you want to capture input you need to create your own event handler and check for stuff like:

bool PawsManager::HandleEvent( iEvent &event ){    switch ( event.Type )    {        case csevMouseMove: return HandleMouseMove( event );        case csevMouseDown: return HandleMouseDown( event );        case csevMouseUp  : return HandleMouseUp( event );    } //Mouse is at: // event.Mouse.x, event.Mouse.y 


sorry i didnt word my reply too clearly, how do you get the x and y co-ordinates to pass to the function
http://stowelly.co.uk/
Quote:Original post by Stowelly
thanks alot, are there any other sites apart from the actual crystal space one that are good for information about it


The CS-Main mailing list ( check for actualy address on Crystal's site ) is pretty active as well as the #crystalspace on irc.freenode.net

This topic is closed to new replies.

Advertisement