diff --git a/cocos/2d/CCMotionStreak.cpp b/cocos/2d/CCMotionStreak.cpp index bc86d9b5ba..34805f3aad 100644 --- a/cocos/2d/CCMotionStreak.cpp +++ b/cocos/2d/CCMotionStreak.cpp @@ -169,6 +169,11 @@ float MotionStreak::getPositionX() const return _positionR.x; } +Vec3 MotionStreak::getPosition3D() const +{ + return Vec3(_positionR.x, _positionR.y, getPositionZ()); +} + void MotionStreak::setPositionX(float x) { if (!_startingPositionInitialized) { diff --git a/cocos/2d/CCMotionStreak.h b/cocos/2d/CCMotionStreak.h index 97ab7c749f..a4acb735f7 100644 --- a/cocos/2d/CCMotionStreak.h +++ b/cocos/2d/CCMotionStreak.h @@ -75,6 +75,7 @@ public: virtual void setPositionY(float y) override; virtual float getPositionX(void) const override; virtual float getPositionY(void) const override; + virtual Vec3 getPosition3D() const override; /** * @js NA * @lua NA