IonicWind Software

IWBasic => Games and Graphics => Topic started by: pistol350 on October 26, 2008, 08:38:49 AM

Title: Click on an object (sprite) in a scene ?
Post by: pistol350 on October 26, 2008, 08:38:49 AM
The only thing I can guess now is that massive pointer usage must be required to do that  ::)
I don't have any other idea about that.
Any idea ?
Title: Re: Click on an object (sprite) in a scene ?
Post by: Ionic Wind Support Team on October 26, 2008, 09:45:11 AM
2D or 3D?

For 2D use SpriteCollidedEx and a 1 pixel sprite that you create with CreateSprite

For 3D it depends on what you are trying to click on. 

If you are trying to click on an 3D object, known as picking, Create a vector using C3DCamera::Project at z=0.
Then use C3DObject::RayCollided with the direction straight into the screen.

Foe 3D Sprites just use rectangle hit testing, such as the API function PtInRect

Paul.
Title: Re: Click on an object (sprite) in a scene ?
Post by: pistol350 on October 26, 2008, 01:30:47 PM
Hi Paul!
I meant to do that in 2D for the present time but maybe in 3D in the future.
Your suggestion is a neat idea.
I'll give it a try and see what i can come up with.