moving object in 3D space

I need to move an object in 3D space using mouse coordinates, something similar to RTS unit moving.

Picking the piece is working now I need to move it to where I click with the mouse.

I already seen this:

discourse.panda3d.org/viewtopic.php?t=5409

The problem is that I need to move the pieces on top of this board not on a plane like in the example.

Is there some way to convert the board into a plane so I can use IntersecstLine() ? the model object doesnt seem to have this method.

Any ideas?[/img]

You just need to create a Plane object that corresponds to the surface of your board. This is easy to do: it looks like your board is flat in the XY plane, right? That means you need a Plane with a normal of (0, 0, 1), with the Z axis pointing up. Then you pick a point on the plane, any point on the surface of your board, for instance (0, 0, 0) (assuming your board is at z == 0).

Pass both the point and the normal to the Plane constructor, et voilà!

Note that the chessboard sample also does what you’re asking for.

David

Thanks, I ended up figuring that out. Works pretty well :slight_smile: Thanks for the response.