zoukankan      html  css  js  c++  java
  • [原创]为Irrlicht中的人物添加武器

    在Irrlicht中的人物添加武器 其实相当简单:找到关节然后attach上去就ok了。

     scene::IAnimatedMesh* pManMesh = smgr->getMesh("../../media/noblade.ms3d");
     scene::IAnimatedMeshSceneNode* pnMan = smgr->addAnimatedMeshSceneNode( pManMesh );
     pnMan->setMaterialTexture(0, driver->getTexture("../../media/skin.jpg"));
     pnMan->setMaterialFlag(video::EMF_LIGHTING, false);
     pnMan->setPosition(core::vector3df(50,50,-60));
     pnMan->setScale(core::vector3df(5,5,5));
     pnMan->setAnimationSpeed(25*10);
     // this is a scene node where we can attach things to joints
     scene::ISceneNode* pJointNode = pnMan->getMS3DJointNode("leftWeaponJoint");
     if(pJointNode)
     {
      scene::IAnimatedMesh* pWeapon = smgr->getMesh("../../media/blade.ms3d");
      scene::IAnimatedMeshSceneNode* pnWeapon = smgr->addAnimatedMeshSceneNode( pWeapon );
      pnWeapon->setScale(core::vector3df(2,2,2));
      core::vector3df jointPos = pJointNode->getAbsolutePosition();
      //pnWeapon->setPosition(jointPos);
      pJointNode->addChild( pnWeapon );
      printf("Join weapon to body, x=%d, y=%d, z=%d\n", jointPos.X, jointPos.Y, jointPos.Z);
     }
     
     
     
  • 相关阅读:
    scjp考试准备
    scjp考试准备
    scjp考试准备
    scjp考试准备
    maven学习手记
    maven学习手记
    ExtJS MVC 学习手记3
    调整maven配置文件
    ExtJS MVC学习手记 2
    ExtJS MVC学习手记 1
  • 原文地址:https://www.cnblogs.com/flysnow/p/457830.html
Copyright © 2011-2022 走看看