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 8403287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:18:13+00:00 2026-06-09T22:18:13+00:00

I have implemented the Bullet Physics engine into my android program with the NDK

  • 0

I have implemented the Bullet Physics engine into my android program with the NDK (I am using Vuforia’s imagetarget example for android), and it is set up and working correctly, however I would like to render/draw my collision boxes/planes to see my rigid bodies (btRigidBody)/collision shapes (btCollisionShape), I’m positive this is possible but I can’t find any tutorials on how to do it!

I have taken the hello world Bullet physics tutorial on their wiki page and modified it to apply the transformations from the falling physics body to a 3d object I have in opengl es 2.0 to view the collision bodies, here is the code I am using to render to object:

void drawRigidBody(btRigidBody* body,QCAR::Matrix44F modelViewMatrix, unsigned int textureID)
{
btTransform trans;
body->getMotionState()->getWorldTransform(trans);
    LOG("sphere pos: (x %f , y %f, z %f)",trans.getOrigin().getX(),trans.getOrigin().getY(),trans.getOrigin().getZ());


    float physicsMatrix[16];
    trans.getOpenGLMatrix(physicsMatrix);

    SampleUtils::scalePoseMatrix(kObjectScale, kObjectScale, kObjectScale,
            &modelViewMatrix.data[0]);

    QCAR::Matrix44F modelViewProjection, objectMatrix;
    SampleUtils::multiplyMatrix(&modelViewMatrix.data[0], physicsMatrix, &objectMatrix.data[0]);
    SampleUtils::multiplyMatrix(&projectionMatrix.data[0], &objectMatrix.data[0], &modelViewProjection.data[0]);



    glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0,
            (const GLvoid*) &signVerts[0]);
    glVertexAttribPointer(normalHandle, 3, GL_FLOAT, GL_FALSE, 0,
            (const GLvoid*) &signNormals[0]);
    glVertexAttribPointer(textureCoordHandle, 2, GL_FLOAT, GL_FALSE, 0,
            (const GLvoid*) &signTexCoords[0]);

    glEnableVertexAttribArray(vertexHandle);
    glEnableVertexAttribArray(normalHandle);
    glEnableVertexAttribArray(textureCoordHandle);

    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, textureID);
    glUniformMatrix4fv(mvpMatrixHandle, 1, GL_FALSE,
            (GLfloat*)&modelViewProjection.data[0] );
    glDrawArrays(GL_TRIANGLES, 0, signNumVerts);
}

EDIT: looking at the code for btBoxShape i noticed you can grab the box vertices and normals:

btVector3** vertices= wallShape->getVertices();
btVector3**normals = wallShape->getNormals();

but you can’t grab a list of indices to draw the vertex points in a certain order!

  • 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-09T22:18:15+00:00Added an answer on June 9, 2026 at 10:18 pm

    If I recall correctly, this is not the proper way to draw debug shapes in Bullet. Did you read the user manual (PDF), page 16?

    You are supposed to implement your own debug drawer class which implements btIDebugDraw, and in this class you implement the drawLine method.

    You pass this debug drawer to bullet with setDebugDrawer, and then enable it with world->getDebugDrawer->setDebugMode(debugMode);

    To draw the world, call world->debugDrawWorld();

    This then calls drawLine on your custom function numerous times until a wireframe model of the physics world has been drawn.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have bullet physics set up and working on the iPhone but now I
I have implemented Facebook into my app but now I find that whenever I
I have implemented clean URLs using the following in my .htaccess RewriteEngine on RewriteCond
I have implemented a very basic sign up using email address+name, although I would
I have implemented one matrix multiplication with boost::numeric::ublas::matrix (see my full, working boost code
I have implemented language localization to an Android application. My questions are: I can't
I have implemented Twitter4J in my Android application and it's works fine. But after
I have implemented quartz scheduler in my application. And its working upto a certain
I have implemented audio playback using AVPlayer, playing a remote mp3 url. I want
I have implemented a view-based NSOutlineView in my project. I am using floating group

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.