ODE仿真引擎使用(二)
新建C++空项目
1、ode相关头文件加入工程文件中
属性->配置属性->C/C++ ->常规->附加包含目录 :
D:\ODE\ode-0.16\include |
2、引入 ode 依赖的库文件 ode_doubled.lib, drawstuffd.lib
属性->配置属性->链接器->输入->附加依赖项:
D:\ODE\ode-0.16\lib\DebugDoubleDLL\ode_doubled.lib |
3、加入预编译定义 dDOUBLE
属性->配置属性->C/C++ ->预处理器->预处理器定义->
_MT |
4、资源文件设置
对应的dll文件复制到C/windows/sys32 or sysWOW64
Drawstuffd.dll
ode_doubled.dll
#include "texturepath.h"
头文件里面对应的位置F:/ODE/drawstuff/textures
A typical simulation will proceed like this:
- Create a dynamics world.
- Create bodies in the dynamics world.
- Set the state (position etc) of all bodies.
- Create joints in the dynamics world.
- Attach the joints to the bodies.
- Set the parameters of all joints.
- Create a collision world and collision geometry objects, as necessary.
- Create a joint group to hold the contact joints.
- Loop:
- • Apply forces to the bodies as necessary.
- • Adjust the joint parameters as necessary.
- • Call collision detection.
- • Create a contact joint for every collision point, and put it in the contact joint group.
- • Take a simulation step.
- • Remove all joints in the contact joint group.
- Destroy the dynamics and collision worlds.