0

こんにちは、私は LIBGDX を使用しており、prismaticjointdef を作成し、この定義からジョイントを作成しました

PrismaticJointDef prismaticJointDef = new PrismaticJointDef();
    prismaticJointDef.initialize(
            cart,
            axle1,
            axle1.getWorldCenter(),
            new Vector2(0, 1));
    prismaticJointDef.lowerTranslation = -32*scale;
    prismaticJointDef.upperTranslation = 60*scale;
    prismaticJointDef.enableLimit = true;
    prismaticJointDef.enableMotor = true;

    spring1 = world.createJoint(prismaticJointDef);

しかし、これはジョイントタイプのオブジェクトを返し、このオブジェクトにプリズムジョイント関数を適用できません

例 spring.SetMotorSpeed は間違ったコードです

この問題の解決策を教えてください

また、翻訳制限は

4

1 に答える 1

1

ジョイント型のオブジェクトをプリズマティック型に型キャストする必要があります

spring1 = (PrismaticJoint)world.createJoint(prismaticJointDef);

これで問題が解決するはずです

于 2013-06-27T12:05:56.063 に答える