Methods related to transforming

Suggestion: add the following methods to Spatial:

//rotate based on 3 float values (angles) -- SeySayux
public void setLocalRotation(float x, float y, float z) {
this.getLocalRotation().fromAngles(x,y,z);
}
// rotate based on values in vector (angles) -- SeySayux
public void setLocalRotation(Vector3f v) {
this.getLocalRotation().fromAngles(v.x, v.y, v.z);
}
// adds translation to the current translation -- SeySayux
public void addLocalTranslation(Vector3f v) {
this.getLocalTranslation().add(v);
}
// adds translation to the current translation (floats) -- Seysayux
public void addLocalTranslation(float x, float y, float z) {
this.getLocalTranslaton().x += x;
this.getLocalTranslaton().y += y;
this.getLocalTranslaton().z += z;
}
// adds rotation (quaternion) to current rotation -- SeySayux
public void addLocalRotation(Quaternion q) {
this.getLocalRotation().add(q);
}

//adds rotation (float angles) to current rotation -- SeySayux
public void addLocalRotation(float x, float y, float z) {
float f[] = new float[3];
this.getLocalRotation().toAngles(f);
f[0] += x; f[1] += y; f[2] += z;
this.getLocalTranslation.fromAngles(f);
}

// adds rotation (vector angles) to current rotation -- SeySayux
public void addLocalRotation(Vector3f v) {
addLocalRotation(v.x, v.y, v.z);
}

// adds local scale (float value) -- SeySayux
public void addLocalScale(float localScale) {
        this.localScale.x += localScale;
        this.localScale.y += localScale;
        this.localScale.z += localScale;
}

// adds local scale (Vector value) -- SeySayux
public void addLocalScale (Vector3f localScale) {
this.getLocalScale().add(localScale);
}

So… would it be a good idea to add this?

Does not seem like anyone else would like them there, according to the number of answers :wink:



my opinion: the methods are fine in vector and quat classes and adding them to Spatial only bloats the interface.

Indeed, that's true. But these methods are much more beginner-friendly. If, for example, someone can put the rotation directly in degrees/radians, without having to instantiate a quaternion class, it's much easier to learn than using quaternions. Also it'll make the engine more transparent.

Rather than adding code to be "beginner-friendly", perhaps adding a FAQ or something might be a better idea? :wink:

I've hardly time to write a faq. I've enough on answering my own questions, let alone trying to guess other's questions.

Good thing there’s already one for you. :wink:



http://www.jmonkeyengine.com/wiki/doku.php?id=the_faq



It wouldn’t take any more time than it took you to write those methods to submit to the forum to add those items as tips to the FAQ. 

If you have any ideas…

http://www.jmonkeyengine.com/wiki/doku.php?id=seysayux_tips_and_tricks