Animation.setCurrentFrame will no longer try to call setOrigina or updateDisplayOrigin if the Game Object doesn't have the Origin component, preventing unknown function errors.

This commit is contained in:
Richard Davey 2020-01-27 14:48:50 +00:00
parent 009dad281f
commit 4de9d52769

View file

@ -1020,13 +1020,16 @@ var Animation = new Class({
gameObject.setSizeToFrame();
if (animationFrame.frame.customPivot)
if (gameObject._originComponent)
{
gameObject.setOrigin(animationFrame.frame.pivotX, animationFrame.frame.pivotY);
}
else
{
gameObject.updateDisplayOrigin();
if (animationFrame.frame.customPivot)
{
gameObject.setOrigin(animationFrame.frame.pivotX, animationFrame.frame.pivotY);
}
else
{
gameObject.updateDisplayOrigin();
}
}
return gameObject;