Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - culli

Pages: [1]
Support / Spam
« on: May 16, 2006, 04:34:29 am »
May I suggest you enable "visual confirmation" for forum registrations?  The spam is just starting.  It'll get much worse.   :x


Support / Dragging objects
« on: April 30, 2006, 10:35:06 pm »
Hi, I've been lurking on here for a while and toying with things.  I really like the way JPCT feels.  

Now I'm trying some ideas for a game where part of it is an RTS (starcraft-style) where you're looking down at a terrain and can drag objects around.  To simplify the idea, I'm treating it like checkers.  I want to click and drag a piece from one position to another.  There have been some great things in the forums that have helped with other problems I've had, but the one I can't figure out right now is that the piece doesn't "keep up" with the mouse cursor.  I can scalarMul the ray to help the problem some, but I want it to keep up exactly with the mouse.

Can't say my vector math skills are more than beginner, but I'm reading some books and learning.

Here's what I've got right now in the "mousedragged" event:

(lastPiece is selected on mouse moves)

Code: [Select]

SimpleVector currentRay = Interact2D.reproject2D3D(theWorld.getCamera(), buffer, e.getX(), e.getY());
//deal with the camera space
Matrix orient2 = theWorld.getCamera().getFront();
float[] dump2 = orient2.getDump();
SimpleVector ray2 = new SimpleVector();
ray2.x = dump2[0] * currentRay.x + dump2[1] * currentRay.y + dump2[2] * currentRay.z + dump2[3] * 1;
ray2.y = dump2[4] * currentRay.x + dump2[5] * currentRay.y + dump2[6] * currentRay.z + dump2[7] * 1;
ray2.z = dump2[8] * currentRay.x + dump2[9] * currentRay.y + dump2[10] * currentRay.z + dump2[11] * 1;
ray2.y = lastPiece.getOrigin().y;
lastX = e.getX();
lastY = e.getY();

What am I doing wrong?


Pages: [1]