[MDX] PLEASE HELP !! Drag And Drop?

Started by
19 comments, last by Grattier 18 years, 2 months ago
I have an Object Camera that let me rotate around my target... but now. i want to be able to drag and drop the object using right button... any ideas where i can find a tutorial about that? I'm able to make it move but never like I want... [Edited by - Grattier on February 7, 2006 7:37:03 AM]
Advertisement
Hi,

I don't know if you have managed picking already, in case not, then you'll find many threads on the forum about picking (like this).

After you know which object to move, then you'll have to ask yourself: which is the surface you want your object to move on? As you can imagine, a single pixel on the screen, on which you point your mouse, corresponds to an infinite number of points in 3D space, standing on the line right behind your cursor.
Once you know which surface or distance is the one, then you just intersect the ray coming from the eye, through the mouse cursor, with the your surface, and place the object there.

Hope this helps,
kp


------------------------------------------------------------Neo, the Matrix should be 16-byte aligned for better performance!
My big problem is that i'm not using mesh... i create my object with vertex/index ... and i don't know how to retreive the intersect information from custom stuff
Hi,

if you have vertices and indices, then you have a mesh, don't you?
you just have to wrap it, if you need an ID3DXMesh.
On the other hand, you don't have to intersect if you want to pick. We here use a method that renders a "pick screen", on which every object is rendered, but using object ids, face ids, etc as colors. Then, the object right under the mouse can be looked up from this render target texture. It's not optimal in the sense of speed, but it works pretty good.

kp
------------------------------------------------------------Neo, the Matrix should be 16-byte aligned for better performance!
I set some vertices / index... and after i make many device.DrawIndexedPrimitives(PrimitiveType.TriangleStrip .. something like 300 times... and the final result is my object. It's not for a games it's a really specific apps.

I know how to get the start / direction.. now all i want to know is.. wich DrawIndexedPrimitives is selected in my 300!

Thanks a+
Perhaps you could intersect your ray with just the bounding volumes of your primitives - would that do?
Failing that I'm afraid you'll have to go through all the faces and intersect your ray manually!
Yes i can go through the bounding volumes of my primitive...

In fact, that's what i'm working on for now.. the Only big problem that i have now.. is the intersect...

I have my Start and my direction... but i can't figure how to test the intersect manually..

Exemple:
Start at: 34000, 0, 96000
Direction: -0.99, 0.25, -0.03

I understand what's the meaning of that.. but I can't figure how to use it..

with mesh it's easy.. intersect(start,direction,device) something like that... bu it's not for a mesh

If i click on my object, I need to compare this information and see if it's going though my object somewhere (my object can be separate into many box) and put a special effect on this "parts" (box) ..
Please help me..

I have my Direction MAtrix and my Start Matrix... and i know bounds of my object... how can i know if i clicked it?
Ok so here is my PICKING solution:

Use Geometry.BoxBoundProbe( lower-left corner, upper-right corner, start, direction)

It work great!


Now i need to know my destination distance

[Edited by - Grattier on February 7, 2006 7:12:31 AM]
Thanks for posting that solution - will be helpful for me too!

This topic is closed to new replies.

Advertisement