212
« on: August 26, 2008, 09:17:15 pm »
I'm trying to make an RPG with 2D backgrounds and a 3D hero. When the player clicks on the screen, the hero has to move that way. The following's what I did (for translation, rotation is something else). Is it wrong, because it's not working?
SimpleVector heroCenter = Interact2D.project3D2D(theCamera, buffer, hero.getTransformedCenter());
SimpleVector destination = Interact2D.reproject2D3D(theCamera, buffer, mousePoint.x-(int)heroCenter.x, mousePoint.y-(int)heroCenter.y, hero.getTransformedCenter().z);
destination.z = destination.y;
destination.y = 0;
hero.translate(destination);