Search code examples
javashapesjmonkeyengine

Resizing an Arrow shape


I have an arrow:

Arrow ballArrow =  new Arrow("Ball Arrow", 2, 0.175f);

And I want to resize it to make it longer whenever a key is pressed (say Key_5).

Which method would I call to resize it as when i'm calling .setLength() and .setWidth() they keep getting slashed out and i'm not sure what that means.

BTW i'm using jMonkeyEngine 2 not 3.


Solution

  • Looking at the Arrow API, setLength and setWidth are deprecated. To do the resizing, you should be doing:

    Arrow ballArrow = new Arrow("Ball Arrow", 2, 0.175f);
    ....
    float newLength = (somevalue);
    float newWidth = (somevalue);
    ballArrow.updateGeometry(newLength, newWidth);
    

    Hope this helps.