private void resetRound(int side) { court.reset_point_scored(); ground_marker_node.RemoveChild(vball.getTransformNode()); vball = new VolleyBall(1f, GROUND_MARKER_SIZE / 2f, bounceSound, false); // Perform initial manipulations if (side == 0) { vball.translate(PLAYER_BALL_START); } else { vball.translate(OPPONENT_BALL_START); } ball_drop_delay = true; ball_drop_countdown = 0; }
private void createObjects() { // Create a marker node to track the ground array ground_marker_node = new MarkerNode(scene.MarkerTracker, "SlimeGroundArray.xml", NyARToolkitTracker.ComputationMethod.Average); scene.RootNode.AddChild(ground_marker_node); InvisibleWall invisWallOne = new InvisibleWall(float.MaxValue, new Vector3(COURT_WIDTH, PLANAR_THICKNESS, COURT_LENGTH)); InvisibleWall invisWallTwo = new InvisibleWall(float.MaxValue, new Vector3(PLANAR_THICKNESS, COURT_LENGTH, COURT_LENGTH)); InvisibleWall invisWallThree = new InvisibleWall(float.MaxValue, new Vector3(COURT_WIDTH, PLANAR_THICKNESS, COURT_LENGTH)); InvisibleWall invisWallFour = new InvisibleWall(float.MaxValue, new Vector3(PLANAR_THICKNESS, COURT_LENGTH, COURT_LENGTH)); invisWallOne.translate(new Vector3(0, COURT_LENGTH / 2, COURT_LENGTH / 2)); invisWallTwo.translate(new Vector3(-(COURT_WIDTH / 2), 0, COURT_LENGTH / 2)); invisWallThree.translate(new Vector3(0, -(COURT_LENGTH / 2), COURT_LENGTH / 2)); invisWallFour.translate(new Vector3(COURT_WIDTH / 2, 0, COURT_LENGTH / 2)); // Add the walls onto the ground marker ground_marker_node.AddChild(invisWallOne.getTransformNode()); ground_marker_node.AddChild(invisWallTwo.getTransformNode()); ground_marker_node.AddChild(invisWallThree.getTransformNode()); ground_marker_node.AddChild(invisWallFour.getTransformNode()); // Create the court court = new Court(float.MaxValue, new Vector3(COURT_WIDTH, COURT_LENGTH, PLANAR_THICKNESS * 4)); // Initial translation court.translate(new Vector3(0, 0, -14f)); // Add it to the scene ground_marker_node.AddChild(court.getTransformNode()); // Time to create the net Net net = new Net(float.MaxValue, new Vector3(COURT_WIDTH, PLANAR_THICKNESS, GROUND_MARKER_SIZE)); // Initial translation net.translate(new Vector3(0, 0, 1f + (GROUND_MARKER_SIZE / 2))); // Add it to the scene ground_marker_node.AddChild(net.getTransformNode()); // Lets create the all important volleyball if (selected_game_type == (int)game_types.opponent) { vball = new VolleyBall(1f, GROUND_MARKER_SIZE / 2f, bounceSound, true); } else { vball = new VolleyBall(1f, GROUND_MARKER_SIZE / 2f, bounceSound, false); } // Perform initial manipulations vball.translate(PLAYER_BALL_START); // Add it to the scene ground_marker_node.AddChild(vball.getTransformNode()); // Create a marker node to track the paddle player_marker_node = new MarkerNode(scene.MarkerTracker, "id511.xml", NyARToolkitTracker.ComputationMethod.Average); scene.RootNode.AddChild(player_marker_node); // Create the slime for the player //player_slime = new Paddle(float.MaxValue, new Vector3(WAND_MARKER_SIZE * 1.5f, WAND_MARKER_SIZE * 1.5f, 3f), Color.Red.ToVector4()); player_slime = new Slime(float.MaxValue, GROUND_MARKER_SIZE, new Vector4(0.160784f, 0.501961f, 0.72549f, 1f), COURT_WIDTH / 2, -1 * COURT_WIDTH / 2, 0f, -1 * COURT_LENGTH / 2); // Initial translation player_slime.translate(PLAYER_SLIME_START); //player_slime.setRotation(Quaternion.CreateFromAxisAngle(Vector3.UnitX, MathHelper.ToRadians(-PADDLE_ANGLE))); //player_slime.setRotation(Quaternion.CreateFromAxisAngle(Vector3.UnitX, MathHelper.ToRadians(90))); // Add it to the scene ground_marker_node.AddChild(player_slime.getTransformNode()); // Create the slime for the opponent //opponent_slime = new Paddle(float.MaxValue, new Vector3(WAND_MARKER_SIZE * 1.5f, WAND_MARKER_SIZE * 1.5f, 3f), Color.Purple.ToVector4()); opponent_slime = new Slime(float.MaxValue, GROUND_MARKER_SIZE, new Vector4(0.556863f, 0.266667f, 0.678431f, 1f), COURT_WIDTH / 2, -1 * COURT_WIDTH / 2, COURT_LENGTH / 2, 0f); // Initial translation opponent_slime.translate(OPPONENT_SLIME_START); //opponent_slime.setRotation(Quaternion.CreateFromAxisAngle(Vector3.UnitX, MathHelper.ToRadians(PADDLE_ANGLE))); //opponent_slime.setRotation(Quaternion.CreateFromAxisAngle(Vector3.UnitX, MathHelper.ToRadians(90))); // Add it to the scene ground_marker_node.AddChild(opponent_slime.getTransformNode()); // Create the laser sight target target = new Target(TARGET_SIZE, Color.Red.ToVector4()); // perform initial translations target.setTranslation(new Vector3(PLAYER_BALL_START.X, PLAYER_BALL_START.Y, (TARGET_SIZE / 2) + PLANAR_THICKNESS)); // Add it to the scene ground_marker_node.AddChild(target.getTransformNode()); }