Box2d c ++, что похоже на ActionScript b2Body SetPosition?

я пытаюсь перенести некоторый код из 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)));

его коробка с углом гипотенузы

0

Решение

Извините, думал, что вы переходите с C ++ на AS3

Беглый взгляд на код: https://github.com/cocos2d/cocos2d-x/blob/ac2c0469c71eaabff38f545ce956859627f2b7fc/external/Box2D/Dynamics/b2Body.cpp

Это похоже на SetPosition() сейчас SetTransform(const b2Vec2& position, float32 angle), Это потому, что они запасают позицию и вращение как b2Transform за кулисами. Даже GetPosition() просто возвращает position собственность b2Transform

2

Другие решения

Других решений пока нет …