I'm trying to get a start point and when the mouse falls off a platform, he goes back to it, but I'm having some problems.
first I made a matrix called "start' and after the mouse was in the world used
start.setTo(mouse.getTranslationMatrix());
When the mouse is in the jump function I check y position and if it's over 20 I do:
mouse.setTranslationMatrix(start);
This works one time, but the next time he misses a platform it doesn't work anymore.
Maybe that's because getXXXMatrix() returns a reference, not a new matrix and you modify your start matrix implicitly that way? Try something like start=new Matrix(getTranslationMatrix()); and setTranslationMatrix(new Matrix(start)); and see if that helps.
The Matrix constructor doesn't take an argument.
This seems to work but I haven't tried it out for getting different positions. I can get the mouse back to the origin by:
mouse.setTranslationMatrix(new Matrix());
and then give it it's original translation.
mouse.translate(-100, -20, -200);
Since I can get translation of a 3d object from the origin, I should be able to record last position and move it back that way.
Quote from: fireside on August 08, 2008, 09:26:59 PM
The Matrix constructor doesn't take an argument.
Opps, my bad. I've mixed this with SimpleVector. But you can use cloneMatrix() instead.
I had tried cloneMatrix and still was having trouble but it's probably something dumb I'm doing. Anyway, I can get it to work with this other way.
Ok, fine. I'll add that Matrix-constructor anyway to avoid further confusion (of myself) in the future.
I think that would be a good idea, also. It just seems like it belongs there.