If you can't explain it simply,

you don't understand it well enough.

ODE仿真引擎使用(二)

  新建C++空项目

  1、ode相关头文件加入工程文件中
属性->配置属性->C/C++ ->常规->附加包含目录 :

 

D:\ODE\ode-0.16\include

D:\ODE\ode-0.16\ode\src

D:\ODE\ode-0.16\ode\demo

这三个都得添加

  2、引入 ode 依赖的库文件 ode_doubled.lib, drawstuffd.lib
属性->配置属性->链接器->输入->附加依赖项:

 

D:\ODE\ode-0.16\lib\DebugDoubleDLL\ode_doubled.lib
D:\ODE\ode-0.16\lib\DebugDoubleDLL\drawstuffd.lib
user32.lib
winmm.lib
gdi32.lib
opengl32.lib
glu32.lib

  3、加入预编译定义 dDOUBLE
属性->配置属性->C/C++ ->预处理器->预处理器定义->

 

_MT
_DEBUG
dIDEDOUBLE
CCD_IDEDOUBLE
WIN32
_CRT_SECURE_NO_DEPRECATE
_SCL_SECURE_NO_WARNINGS
_USE_MATH_DEFINES

  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.
posted @ 2020-02-05 22:37  赵小亮  阅读(778)  评论(0编辑  收藏  举报


Though the night was made for loving,
and the day returns too soon,
yet we'll go no more a-roving
by the light of the moon.