惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
Netflix TechBlog - Medium
罗磊的独立博客
云风的 BLOG
云风的 BLOG
Last Week in AI
Last Week in AI
Y
Y Combinator Blog
小众软件
小众软件
Blog — PlanetScale
Blog — PlanetScale
T
The Blog of Author Tim Ferriss
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
月光博客
月光博客
博客园 - Franky
F
Fortinet All Blogs
D
Docker
博客园 - 司徒正美
腾讯CDC
Recent Announcements
Recent Announcements
The Cloudflare Blog
B
Blog RSS Feed
GbyAI
GbyAI
T
Tailwind CSS Blog
雷峰网
雷峰网
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 三生石上(FineUI控件)
阮一峰的网络日志
阮一峰的网络日志

博客园 - 安徽飞雪游戏工作室

贴几张我们用irrlicht做的游戏截图 jpg图片效果有点差,看起来是不是有点像劲舞团? 3dmax导出为my3d教程 从内存中加载图片资源 3dmax文件导出到ms3d文件. irrlicht1.3中文支持 Audiere PK OpenAL 【原创】IrrLicht中ms3D模型不支持多个贴图问题的解决 【引】[翻译]Irrlicht引擎里的冲突检测与响应 [原创]IrrLicht中MS3D模型骨骼动画支持bug的排除 MS3D model 的 Frame count - 安徽飞雪游戏工作室 材质动画 Irrlicht 论坛好贴 精选(不断补充中...) [转]Scrolling Credits Code [原创]为Irrlicht中的人物添加武器 [原创]Irrlicht中的Texture透明色(colorkey) [原创]IrrLicht的GUI使用 [原创]IrrLicht-1.0中文支持 [原创]一个在Irrlicht中会常用的字符串转换函数 [转]宽字符标量L"xx"在VC6.0/7.0和GNU g++中的不同实现。
[转](C++) How to animate and move an entity
安徽飞雪游戏工作室 · 2006-07-23 · via 博客园 - 安徽飞雪游戏工作室

[http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=12238]

So far my contributions for this community had been rather miserable, so I decided it's time to make up for it by posting piece of code from my own test application. Maybe it's not as decent as I would like it to be, but I nonetheless decided to share it with you. It's a method for moving an entity through the scenery, setting appropiate animation loop and detecting whether it collides with the scenery or not. The method itself goes like this:

Code:

void Character::Walk(float speed, ISceneCollisionManager* colmanger, ITriangleSelector* selector)
{
   core::vector3df OriginalPosition;
   core::vector3df TranslationVector;
   core::triangle3df triout;

   bool isfalling = true; //set it to "false" if you want the gravity off

   OriginalPosition=this->position;

   TranslationVector.X=((float)(cos(this->heading*PI/180))*speed);
   TranslationVector.Z=-((float)(sin(this->heading*PI/180))*speed);

   this->position = colmanger->getCollisionResultPosition(selector, OriginalPosition, vector3df(10,50,10), TranslationVector, triout, isfalling, 10);
   this->model->setPosition(position);

   if (this->state!=STATE_WALK)
   {
      this->state=STATE_WALK;
      this->model->setMD2Animation("run");
      this->model->setLoopMode(true);
   }

"This" refers to character type object. "State" is an integer value that indicates in what state the entity is at the moment. For now I've only defined two states, namely STATE_WALK the character is in when walking and STATE_STAND the character type object is in when it's not moving. "Model" is an Irrlicht scene node representing the entity. For stopping characters' movement, I'm using this method:

Code:

void Character::Stop()
{
   this->state=STATE_STAND;
   this->model->setMD2Animation("stand");
}

I hope this post will be of some help to newcomers who want to create their own Irrlicht-based 3-person type game without resorting to external libraries (like Newton) but don't know where to start.

以上主要是调用ISceneCollisionManager::getCollisionResultPosition来得到人物与3d world碰撞后的新position。
This can be used for moving a character in a 3d world: The character will slide at walls and is able to walk up stairs.