thebolt helped me some on IRC.
He suggested csEngineTools::FindScreenTarget.
So I used it, and it detects if a wall is clicked on, but it can't find Cubard
at all:
The updated code is found here:
http://rapidshare.com/files/139322800/xyzim.zip.html
If you compile it(which only takes a few seconds) You will confirm when you
click on stuff it always says,"Wall"
The old code I used before would tell me which part of Cubard you clicked on.
Any help?
,Jim
Jim Sager <[EMAIL PROTECTED]> wrote: Hi Jorrit.
The code does compile fine.
The problem is when I click on anything, It sees the mesh as NULL.
I zipped up my project here:
http://rapidshare.com/files/139295540/xyzim.zip.html
The snippet of code I need help with is at: //start
It is the code provided here. The reason I provide my small project along side
is so if someone wanted to help me, they could test out clicking on Cubard.
For someone who understands how to use a mouse to click on objects using
hitbeam, this should be no problem. My real problem is that Peter Amstutz
wrote this code for me so it is like a black box to me. I do not understand
the old code so I can't figure out how to update it.
This code is important to me because it allows me to finish my animation maker.
I had my animation maker finished before and I provided it out as open source.
You can see the results of some of the animations I made at
www.roamingdragon.com if you download the OLD demo.
Thank you Crystal Space community,
Jim
Jorrit Tyberghein <[EMAIL PROTECTED]> wrote: Perhaps tell us why you think it
is messed up? What is wrong and what
is not working?
Greetings,
On Fri, Aug 22, 2008 at 6:40 AM, Jim Sager wrote:
> This code allows a user to select a meshwrapper that they click on using the
> mouse. It is very useful code. The following code is above my head. Peter
> Amstutz wrote it for me back in 2003.
>
> I have since updated to the latest version of CrystalSpace, Hitbeam is
> different, and I do not know how to update my code.
>
> Here is the code:
>
> csVector3 v;
> int FrameWidth, FrameHeight;
> iGraphics2D* g2d = g3d->GetDriver2D ();
> FrameWidth = g2d->GetWidth ();
> FrameHeight = g2d->GetHeight ();
>
> //M.x = Mouse's coordinates x , M.y = Mouse's coordinates y
> csVector2 p (M.x, FrameHeight-M.y);
>
> /*This next line gives the error: error: no matching function for call to
> 'iCamera::InvPerspective(csVector2&, int, csVector3&)'
> */
> view->GetCamera ()->InvPerspective (p, 1, v);
>
> csVector3 vw = view->GetCamera ()->GetTransform ().This2Other (v);
> iSector* sector = view->GetCamera ()->GetSector ();
> csVector3 origin = view->GetCamera ()->GetTransform ().GetO2TTranslation
> ();
> csVector3 isect;
>
> //Now for the old code that no longer works:
> iPolygon3D **sel=NULL;
> iMeshWrapper *temp_wrap= sector->HitBeam (origin, origin + (vw-origin) * 20,
> isect,sel);
>
>
> ----------------------------------------------------------------------------------------------
> Here is another look at my code. I tried changing stuff by reading the docs
> and help from IRC, but I think I messed up stuff.
>
>
> csVector3 v;
>
> int FrameWidth, FrameHeight;
>
> iGraphics2D* g2d = g3d->GetDriver2D ();
>
> FrameWidth = g2d->GetWidth ();
>
> FrameHeight = g2d->GetHeight ();
>
>
>
>
>
>
> csVector2 p (M.x, FrameHeight-M.y);
>
>
> //OLD CODE view->GetCamera ()->InvPerspective (p, 1, v);
> //NEXT LINE = NEW CODE: Is this the problem?
> view->GetCamera ()->InvPerspective (p, 1.0);
>
> csVector3 vw = view->GetCamera ()->GetTransform ().This2Other (v);
>
> iSector* sector = view->GetCamera ()->GetSector ();
>
> csVector3 origin = view->GetCamera ()->GetTransform ().GetO2TTranslation
> ();
>
> csVector3 isect;
>
>
> //OLD CODE iPolygon3D **sel=NULL;
>
> //OLD CODE iMeshWrapper *temp_wrap= sector->HitBeam (origin, origin +
> (vw-origin) * 20, isect,sel);
>
> //NEXT LINE = NEW CODE: Is this the problem?
> iMeshWrapper *temp_wrap=sector->HitBeam(origin,
> origin+(vw-origin)*20,true).mesh;
>
>
>
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Crystal-main mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/crystal-main
> Unsubscribe:
> mailto:[EMAIL PROTECTED]
>
>
--
Project Manager of Crystal Space (http://www.crystalspace3d.org)
and CEL (http://cel.crystalspace3d.org)
Support Crystal Space. Donate at
https://sourceforge.net/donate/index.php?group_id=649
Visit my town at http://waldir.myminicity.com/
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Crystal-main mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/crystal-main
Unsubscribe: mailto:[EMAIL PROTECTED]
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________
Crystal-main mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/crystal-main
Unsubscribe: mailto:[EMAIL PROTECTED]
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Crystal-main mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/crystal-main
Unsubscribe: mailto:[EMAIL PROTECTED]