0
votes

hi i am using LIBGDX and had created prismaticjointdef and created a joint from this def

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);

but this return a joint type oblect and i cant apply prismaticjoint function on this object

eg spring.SetMotorSpeed is wrong code

please tell me the solution of this problem

also the translation limit is

1

1 Answers

1
votes

You need to typecast the object of joint type to Prismatic type

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

This should solve your issuse