Sign in to follow this  

[MDX] PLEASE HELP !! Drag And Drop?

This topic is 4333 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
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


Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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+

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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) ..

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
Quote:
Original post by kovacsp
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



Ok... I still have the Drop problem... I'm able to pick an object but i don't know how to Drag and drop it....

I want to move Every object together... but only if a certain object is clicked.. now I know if my object is clicked but i really dunno how to make the Drag and drop work

Share this post


Link to post
Share on other sites
Quote:
I want to move Every object together... but only if a certain object is clicked.. now I know if my object is clicked but i really dunno how to make the Drag and drop work

if you just want to move your objects in a plane, you just need to translate all the objects you want to move by the mouse offset from the previous frame. simliar process to dragging a 2d panel.
if you want to move your objects in 3d it would be more complicated.

Share this post


Link to post
Share on other sites
When you detect a mouse down, store the mouse's position and set a boolean value consisting of whether you're in the middle of a drag operation to true.
When mouse moves, if that boolean is true then translate the geometry by some function of the difference between the current mouse position and the one that you stored on mouse down.
Finally, when you detect a mouse up, you set your drag boolean to false, so that the mouse move won't move the geometry.

"Some function" in this context can mean that you map the geometry's x and y positions to those of the mouse drag vector, for example.

The same basic logic works regardless of how many dimensions the geometry is in.

Share this post


Link to post
Share on other sites
Yeah i'm already doing that.. except that i'm using a MouseDown instead of boolean


It's really easy to do that in 2D ... What i don't know is how to call the translation.... my world rotate and i know that the mouse moved by X,Y but how many in X,Y,Z

Share this post


Link to post
Share on other sites
Quote:
my world rotate and i know that the mouse moved by X,Y but how many in X,Y,Z

it depends on what kind of movement you're trying to achieve.

eg. if you had a cube sitting on a plane and you want to move the box around on the plane, you'd pick the box, then do repeated mouse-ray-intersect tests with the plane to find your new location until you let go of the mouse button.

Share this post


Link to post
Share on other sites
I don't have any kind of planes.. it's free for all drag and drop... that's why i'm not able to do it...

This weekend i had no time for that but I need to find it tomorrow...

I need help please! Thanks

Share this post


Link to post
Share on other sites
I can't beleive that no one can help me...

I know my Start position... my Direction vector.. My Distance

startposition + ( Distance * direction) = My starting x,y,z

I know my Destination Direction.. The only think I want to know is the Distance of the destination object...


I want a transformation matrix (translation) .. it's not hard!!! But i don't know how please help me...

Share this post


Link to post
Share on other sites
Damn.... I'm on this shit since 1 week !!!!!!!!!!!!!!!!! I search everywhere and try many thing and i never found HOW.. I'm not an expert of Matrix and it don't help me.

The only think i need is a way to know what's my translation plane.

Using my intersect point, i know one point on my translation surface.


I'm 100% sure that there is someone here that know how to do it

Share this post


Link to post
Share on other sites

This topic is 4333 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this