• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Game Breaking News

Latest game breaking news from around the world

  • Submit
  • Disclaimers
  • About
  • DMCA
  • Privacy Policy
  • Contact
  • Show Search
Hide Search

You are here: Home / Assertion error when using .setFixedRotation

Assertion error when using .setFixedRotation

· August 14, 2019 ·

I’m new to Java and coding. I’m trying to create a tower building game using Box2d for Processing. The premise is to build up a tower that has to resist a shot from a cannon. The tougher the tower, the higher the points.

To build the tower, you need to drag and drop blocks that will (eventually, once I’ve dealt with this part) form joints between them, to allow a tower to be built.

My problem comes when choosing options to build from. This is a screenshot of the game screen:

The intention is to click and drag on the screen for a block to appear, and cycle through orientations using keys to pick what you want while the mouse button is held down, while the object is selected. The mouse button is released, and the object can fall into place with its desired orientation.

The way I’ve found that works is to have an integer represent a state, and, when a key is pressed, the integer changes and the block’s orientation changes with it. This is the code I’ve placed within the class to make this happen:

void changeOrientation() { Vec2 pos = box2d.getBodyPixelCoord(body); if (currentBuildingBlockOption == 0) body.setTransform(pos, 0); if (currentBuildingBlockOption == 1) body.setTransform(pos, 90); if (currentBuildingBlockOption == 2) body.setTransform(pos, -45); if (currentBuildingBlockOption == 3) body.setTransform(pos, 45); } 

The code outside the class that I’m trying to call in the draw() function is this:

void updateBlockChoice() 

{ if (buildingBlocks.size()>0) { BuildingBlock currentBlock = buildingBlocks.get(buildingBlocks.size()-1);

  if (mousePressed==true) { currentBlock.changeOrientation(); } } 

}

I think the error has to do with the fixed rotation, as I’ve seen on some other questions, although I’m pretty stumped. I’m also not sure if my method of going about it is the best way to do it. If anyone else has any better solutions, please do let me know.

Thanks for the help!


  • Williams stronger, ready to be more assertive
  • Williams ready to assert himself
  • Ward hails assertive approach
  • Pardew asserts his authority
  • Lawson asserts Nuggets top team in West
  • Officiating error in Arizona 3rd of its kind
  • Errors, bullpen hurt Tigers in loss to Twins
  • Conte: Half of MLB using PEDs
  • Bob Kustra rips BCS over ranking error
  • Brewers marred by error, crumble to Giants 6-1

Filed Under: Tags net use error 67, error assertion failed

Primary Sidebar

RSS Recent Stories

  • One-Punch Man Artist Celebrates New Volume with Do-S Sketch
  • Star Wars Director J.J. Abrams Reveals What Surprised Him Most in The Last Jedi
  • Star Wars: The Mandalorian – Watch the Creator of Spawn Draw Baby Yoda
  • How to watch the final PlayStation State of Play of 2019 and catch the new game reveals
  • Kingdom Hearts 3: Re Mind DLC now-deleted release trailer confirms the return of Final Fantasy characters
Copyright © 2019 Game Breaking News. Power by Wordpress.