diff --git a/cocos/2d/CCNode.cpp b/cocos/2d/CCNode.cpp index 6c0d4eed84..849c0dc9bb 100644 --- a/cocos/2d/CCNode.cpp +++ b/cocos/2d/CCNode.cpp @@ -1800,7 +1800,7 @@ void Node::setAdditionalTransform(const AffineTransform& additionalTransform) setAdditionalTransform(&tmp); } -void Node::setAdditionalTransform(Mat4* additionalTransform) +void Node::setAdditionalTransform(const Mat4* additionalTransform) { if (additionalTransform == nullptr) { @@ -1823,8 +1823,7 @@ void Node::setAdditionalTransform(Mat4* additionalTransform) void Node::setAdditionalTransform(const Mat4& additionalTransform) { - Mat4* mat4= const_cast(&additionalTransform); - setAdditionalTransform(mat4); + setAdditionalTransform(&additionalTransform); } AffineTransform Node::getParentToNodeAffineTransform() const diff --git a/cocos/2d/CCNode.h b/cocos/2d/CCNode.h index 0549f3915d..e1d94190c7 100644 --- a/cocos/2d/CCNode.h +++ b/cocos/2d/CCNode.h @@ -1643,7 +1643,7 @@ public: * * @param additionalTransform An additional transform matrix. */ - void setAdditionalTransform(Mat4* additionalTransform); + void setAdditionalTransform(const Mat4* additionalTransform); void setAdditionalTransform(const Mat4& additionalTransform); void setAdditionalTransform(const AffineTransform& additionalTransform);