Added a setLocalTranslation and setLocalScale to the Bone class. Similarly to setLocalRotation it only works when userControl is set to true and fails otherwise.
Also I changed how the value is set (with a set(...)) because it was assigning the passed parameter to the local instance of the transform.
This commit is contained in:
parent
cd70630502
commit
be6d2765e3
@ -812,13 +812,47 @@ public final class Bone implements Savable {
|
||||
output.writeSavableArrayList(children, "children", null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the rotation of the bone in object space.
|
||||
* Warning: you need to call {@link #setUserControl(boolean)} with true to be able to do that operation
|
||||
* @param rot
|
||||
*/
|
||||
public void setLocalRotation(Quaternion rot){
|
||||
if (!userControl) {
|
||||
throw new IllegalStateException("User control must be on bone to allow user transforms");
|
||||
}
|
||||
this.localRot = rot;
|
||||
this.localRot.set(rot);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the position of the bone in object space.
|
||||
* Warning: you need to call {@link #setUserControl(boolean)} with true to be able to do that operation
|
||||
* @param pos
|
||||
*/
|
||||
public void setLocalTranslation(Vector3f pos){
|
||||
if (!userControl) {
|
||||
throw new IllegalStateException("User control must be on bone to allow user transforms");
|
||||
}
|
||||
this.localPos.set(pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the scale of the bone in object space.
|
||||
* Warning: you need to call {@link #setUserControl(boolean)} with true to be able to do that operation
|
||||
* @param scale the scale to apply
|
||||
*/
|
||||
public void setLocalScale(Vector3f scale){
|
||||
if (!userControl) {
|
||||
throw new IllegalStateException("User control must be on bone to allow user transforms");
|
||||
}
|
||||
this.localScale.set(scale);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns true if this bone can be directly manipulated by the user.
|
||||
* @see #setUserControl(boolean)
|
||||
* @return
|
||||
*/
|
||||
public boolean hasUserControl(){
|
||||
return userControl;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user