Box2d c++ what is the similar to ActionScript b2Body SetPosi
Box2d c++ what is the similar to ActionScript b2Body SetPosition?
i 尝试将一些代码从 ActionScript 移植到 c++ box2d
来自 ActionScript 的代码来自 2011 年,所以我不确定它使用的是哪个版本的 box2d。
我使用最新的.
无论如何,这就是我在操作脚本中所拥有的:
var leftAxle:b2Body=world.CreateBody(leftAxleBodyDef);
leftAxle.CreateFixture(leftAxleFixture);
// this is the part i need to port , there is no SetPosition in the box2d 2.2+ version
leftAxle.SetPosition(new b2Vec2(carPosX/worldScale-axleContainerDistance/worldScale-axleContainerHeight/worldScale*Math.cos((90-axleAngle)*degreesToRadians),carPosY/worldScale+axleContainerDepth/worldScale+axleContainerHeight/worldScale*Math.sin((90-axleAngle)*degreesToRadians)));
用斜边角的盒子
抱歉,以为你正在从C++转换为AS3
快速浏览代码:https://github.com/cocos2d/cocos2d-x/blob/ac2c0469c71eaabff38f545ce956859627f2b7fc/external/Box2D/Dynamics/b2Body.cpp
看来SetPosition()
现在SetTransform(const b2Vec2& position, float32 angle)
.这是因为他们在幕后将位置和轮换作为b2Transform
。即使是GetPosition()
也只是返回b2Transform
的position
属性
相关文章:
- "error: no matching function for call to"构造函数错误
- 调用专用模板时出错"no matching function for call to [...]"
- C++ Singleton - Prevent ::instance() to variable
- 我的项目不会像"undefined reference to `grpc::g_core_codegen_interface'"那样使用未定义的引用错误进行编译
- Visual Studio Code "undefined reference to `WinMain@16'"
- 使用 GCC 卸载的 OpenMP 卸载失败,并出现"Ptx assembly aborted due to errors"
- 如何解决"invalid conversion from 'char' to 'const char*'"
- 使用 MATLAB 编码器生成C++代码:编译错误"undefined reference to `rgb2gray_tbb_real64'"
- 尝试链接我的着色器时,我收到错误代码"error c5145 must write to gl_position"
- Python str to C++ to Python str
- 为什么创建友元类的实例会导致"undefined reference to"错误?
- System.InvalidCastException - SQL to C++ - safe_cast<float>
- 使用 cmake 的 Linux 终端上的"Conversion to non-scalar type is requested"错误
- "no matching function for call to 'Vector::Vector'"错误
- vector<vector<double>> to mxArray using memcpy
- Tensorflow c++ api undefined reference to 'tflite::D efaultErrorReporter()'
- 当覆盖存在时调用基本虚拟"binded to object"函数
- OpenGL VBO Indexing ( How to compute Index Array)
- 为什么我会" void value not ignored as it ought to be"?
- Box2d c++ what is the similar to ActionScript b2Body SetPosi