Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9161095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:53:29+00:00 2026-06-17T13:53:29+00:00

I would like some clarifications on the AndEngine revoluteJoint example. In the code below

  • 0

I would like some clarifications on the AndEngine revoluteJoint example. In the code below the connectionLine has x1,y1 & x2,y2 the same value. So this should create a single point. Why is this done?

final Line connectionLine = new Line(anchorFaceX + spriteWidth / 2, anchorFaceY +
spriteHeight / 2, anchorFaceX + spriteWidth / 2, anchorFaceY + spriteHeight / 2, 
this.getVertexBufferObjectManager());

What does the setPosition do below? Does it transform the line so that it appears to rotate?

this.mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(anchorFace, 
anchorBody, true, true){
@Override
public void onUpdate(final float pSecondsElapsed) {
super.onUpdate(pSecondsElapsed);
final Vector2 movingBodyWorldCenter = movingBody.getWorldCenter();
connectionLine.setPosition(connectionLine.getX1(), connectionLine.getY1(),   
 movingBodyWorldCenter.x * PhysicsConstants.PIXEL_TO_METER_RATIO_DEFAULT, 
movingBodyWorldCenter.y * PhysicsConstants.PIXEL_TO_METER_RATIO_DEFAULT);

}
});

I would appreciate any clarification. I need to create a line that is rigidly connected to bodies as they move.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T13:53:30+00:00Added an answer on June 17, 2026 at 1:53 pm

    I was able to connect the bodies with lines which stay connected as the bodies move as follows

    // Join adjacent bodies
              if(i > 0) {
                     connectionLine[i] = new Line(centers[i][0],centers[i][1],centers[i-1][0],centers[i-1][1],lineWidth,this.getVertexBufferObjectManager());
                     connectionLine[i].setColor(0.0f,0.0f,1.0f);
                     this.mScene.attachChild(connectionLine[i]);     
    
              }
    
              // Join the first body with the last body
              if(i == 19){
                  connectionLine[0] = new Line(centers[0][0],centers[0][1],centers[19][0],centers[19][1],lineWidth,this.getVertexBufferObjectManager());
                  connectionLine[0].setColor(.0f,.0f,1.0f);
                  this.mScene.attachChild(connectionLine[0]);   
              }
    
              // Update connection line so that the line moves along with the body
              this.mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(circle[i], circleBody[i], true, true) {
                  @Override
                    public void onUpdate(final float pSecondsElapsed) {
                        super.onUpdate(pSecondsElapsed);
                        for(int i=1;i < nBodies;i++) {
                            connectionLine[i].setPosition(circle[i].getX(),circle[i].getY(),circle[i-1].getX(),circle[i-1].getY());
    
                        }
                        connectionLine[0].setPosition(circle[0].getX(),circle[0].getY(),circle[19].getX(),circle[19].getY());
                    }
              }       
    
            );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like some clarification on what the code in front of the HTML
I would like to get some clarification to this answer -> Nested stored procedures
I am learning C++ exceptions and I would like some clarification of the scenario:
I got nabbed by the following bug again and would like some clarification to
OK n00b here with SOAP, Would like some clarification on how to use SOAP.
I would like to get some clarification regarding lazy loading and session boundaries etc.
I would like some help about an Android Application. I used the new Google
I would like some help parsing a dynamic (folder.subfolders) xml with xslt, I tried
I would like some container that I can very efficiently append a variable amount
I would like some sugestion on how to design a table that gets like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.