Unable to enable a wheeljoint
Posted: Sat Jan 16, 2016 10:31 pm
				
				Hello, I am using RUBE for the level and vehicle design of a simple game. I am using Rubeloader to load teh scenes but have been unable to enableMotor() or setMotorSpeed() for any joints that are loaded. See below:
Then, in my input adapter when I attempt to control the bike:
I cannot seem to apply any sort of control to the joint. The one thing I can seem to do is apply a force to a body. body.applyForceToCenter(-30, 0, true); has been working.
Any help would be greatly appreciated
Fred
			Code: Select all
RubeSceneLoader loader = new RubeSceneLoader();
RubeScene scene = loader.loadScene(Gdx.files.internal("rube/bicycle.json"));
loader.addScene(Gdx.files.internal("rube/lvl1.json"));
//box2d
world = scene.getWorld();
joints = scene.getJoints();
wheel = (RevoluteJoint) joints.get(0);
System.out.print(wheel.isMotorEnabled());
bodies = scene.getBodies();
body = bodies.get(3);
Code: Select all
@Override
			public boolean keyDown(int keycode) {
				switch(keycode) {
				case Keys.RIGHT:
					wheel.enableMotor(true);
					wheel.setMotorSpeed(-50);
					//System.out.print(wheel.getType());
					//body.applyForceToCenter(30, 0, true);
					break;
				case Keys.LEFT:
					wheel.enableMotor(true);
					wheel.setMotorSpeed(50);
					//body.applyForceToCenter(-30, 0, true);
					//body.applyTorque(250, true);
					break;
				case Keys.ESCAPE:
					((Game) Gdx.app.getApplicationListener()).setScreen(new MainMenu());
					break;
				}
				return false;
			}Any help would be greatly appreciated
Fred