Hi - I have been wresting with rotating an object and then translating it along that rotated axis but with no joy. I have searched for this but havent found actual code.
So what I would really like is code to give an angle of rotation and then translate according to that rotation.
Cool project btw :)
Dave
You can use something like...
SimpleVector vector = SimpleVector.create();
object.getRotationMatrix().getZAxis(vector);
vector.scalarMul(10);
object.translate(vector);
does that specify the angle of rotation or translation? am looking for a way to do one followed by the other (with the translation following the resulting rotated axis)
Thanks!
The attribute in method vector.scalarMul(10) is how large move of object will be.
ok so would you need to rotate before this code?
You can use this code anywhere, before, after rotation, it does not matter. This is useful ex. for car. You may rotate with car, but car will go always forward.