April 18, 2024, 04:10:59 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Click on an object (sprite) in a scene ?

Started by pistol350, October 26, 2008, 08:38:49 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

pistol350

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 ?
Regards,

Peter B.

Ionic Wind Support Team

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.
Ionic Wind Support Team

pistol350

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.

Regards,

Peter B.