diff --git a/components/resource/bulletshape.cpp b/components/resource/bulletshape.cpp index ffff8fb48b..cc0a63359b 100644 --- a/components/resource/bulletshape.cpp +++ b/components/resource/bulletshape.cpp @@ -71,13 +71,15 @@ namespace Resource deleteShape(shape); } - BulletShape::BulletShape(const BulletShape& copy, const osg::CopyOp& copyop) - : mCollisionShape(duplicateCollisionShape(copy.mCollisionShape.get())) - , mAvoidCollisionShape(duplicateCollisionShape(copy.mAvoidCollisionShape.get())) - , mCollisionBox(copy.mCollisionBox) - , mAnimatedShapes(copy.mAnimatedShapes) - , mFileName(copy.mFileName) - , mFileHash(copy.mFileHash) + BulletShape::BulletShape(const BulletShape& other, const osg::CopyOp& copyOp) + : Object(other, copyOp) + , mCollisionShape(duplicateCollisionShape(other.mCollisionShape.get())) + , mAvoidCollisionShape(duplicateCollisionShape(other.mAvoidCollisionShape.get())) + , mCollisionBox(other.mCollisionBox) + , mAnimatedShapes(other.mAnimatedShapes) + , mFileName(other.mFileName) + , mFileHash(other.mFileHash) + , mVisualCollisionType(other.mVisualCollisionType) { } @@ -94,13 +96,8 @@ namespace Resource } BulletShapeInstance::BulletShapeInstance(osg::ref_ptr source) - : mSource(std::move(source)) + : BulletShape(*source) + , mSource(std::move(source)) { - mCollisionBox = mSource->mCollisionBox; - mAnimatedShapes = mSource->mAnimatedShapes; - mVisualCollisionType = mSource->mVisualCollisionType; - mCollisionShape = duplicateCollisionShape(mSource->mCollisionShape.get()); - mAvoidCollisionShape = duplicateCollisionShape(mSource->mAvoidCollisionShape.get()); } - } diff --git a/components/resource/bulletshape.hpp b/components/resource/bulletshape.hpp index 34b3234130..9610fde49f 100644 --- a/components/resource/bulletshape.hpp +++ b/components/resource/bulletshape.hpp @@ -61,7 +61,7 @@ namespace Resource VisualCollisionType mVisualCollisionType = VisualCollisionType::None; BulletShape() = default; - BulletShape(const BulletShape& copy, const osg::CopyOp& copyop); + BulletShape(const BulletShape& other, const osg::CopyOp& copyOp = osg::CopyOp()); META_Object(Resource, BulletShape) @@ -76,7 +76,7 @@ namespace Resource class BulletShapeInstance : public BulletShape { public: - BulletShapeInstance(osg::ref_ptr source); + explicit BulletShapeInstance(osg::ref_ptr source); const osg::ref_ptr& getSource() const { return mSource; }