Skip to content

Commit 4de9d52

Browse files
committed
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.
1 parent 009dad2 commit 4de9d52

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

src/gameobjects/components/Animation.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,13 +1020,16 @@ var Animation = new Class({
10201020

10211021
gameObject.setSizeToFrame();
10221022

1023-
if (animationFrame.frame.customPivot)
1023+
if (gameObject._originComponent)
10241024
{
1025-
gameObject.setOrigin(animationFrame.frame.pivotX, animationFrame.frame.pivotY);
1026-
}
1027-
else
1028-
{
1029-
gameObject.updateDisplayOrigin();
1025+
if (animationFrame.frame.customPivot)
1026+
{
1027+
gameObject.setOrigin(animationFrame.frame.pivotX, animationFrame.frame.pivotY);
1028+
}
1029+
else
1030+
{
1031+
gameObject.updateDisplayOrigin();
1032+
}
10301033
}
10311034

10321035
return gameObject;

0 commit comments

Comments
 (0)