bulletphysics

Bouncing ball in Bullet

旧巷老猫 提交于 2019-12-06 09:24:14
I have two questions with regards to Bullet, but they are related. In the HelloWorldApp, the objective is to get a ball bouncing on a box right? If I wanted to test a plane, could I just add in a btCollisionObject with a btStaticPlaneShape instead of the box? How can I set custom restitution, static and kinetic friction per object? Yes, I believe that should be correct Restitution and friction can be set per object by supplying them to the btRigidBodyConstructionInfo object passed into the btRigidBody constructor For example: btBoxShape * box = new btBoxShape(0.5f,0.5f,0.5f); btVector3 inertia

Integrate a Bullet simple demo in Qt

被刻印的时光 ゝ 提交于 2019-12-05 21:36:47
I want to integrate a Bullet demo into a Qt application. I am using the Bullet demo example that comes with Bullet, called App_BasicDemo. If I execute this application without Qt, it opens a window and renders very well. So I thought, if I just put this as a QGLWidget, it should do the same thing in a Qt window. But it does not work. In the constructor of my GLWidget, I create the BasicDemo. In initializeGL, I call myinit and initPhysics of the BasicDemo. And finally, in paintGL, I call clientMoveAndDisplay. The first problem I had, was that clientMoveAndDisplay would crash when calling

What does “step” mean in stepSimulation and what do its parameters mean in Bullet Physics?

浪子不回头ぞ 提交于 2019-12-05 08:27:27
What does the term "STEP" means in bullet physics? What does the function stepSimulation() and its parameters mean? I have read the documentation but i could not get hold of anything. Any valid explanation would be of great help. btDynamicsWorld::stepSimulation( btScalar timeStep, int maxSubSteps=1, btScalar fixedTimeStep=btScalar(1.)/btScalar(60.)); timeStep - time passed after last simulation. Internally simulation is done for some internal constant steps. fixedTimeStep fixedTimeStep ~~~ 0.01666666 = 1/60 if timeStep is 0.1 then it will include 6 ( timeStep / fixedTimeStep ) internal

Relative gravity

扶醉桌前 提交于 2019-12-04 03:20:41
I've started using jMonkey engine recently, which is very nice. But I got stuck trying to implement relative gravity. I want to make planets orbiting around each other (not necessarily in perfectly circular orbit, depends on velocity). So every object should affect other objects. What I have right now: turning off global gravity bulletAppState.getPhysicsSpace().setGravity(Vector3f.ZERO); initializing spheres and adding to physics space Sphere sphere = new Sphere(50, 50, 5); Geometry sun = new Geometry("Sun", sphere); sun.setMaterial(stone_mat); rootNode.attachChild(sun); sun

Bullet Physics Simplest Collision Example

蓝咒 提交于 2019-12-04 02:49:02
I'm trying to use Bullet Physics for collision detection only. I don't need it to move any objects for me or handle rendering with callbacks. I just want to update object locations every frame and use it to tell me when I have collisions. To get the simplest example going, I'm trying to find collisions between objects with btBoxShape as their shape. Everything runs fine without crashes or apparent memory leaks, but I get no collisions so I must be making some mistakes somewhere. I'll try to keep this as brief as I can without leaving anything important out. Here's my world setup function:

How to get the Euler rotation of a rigid body between 0 to 360 in Bullet Physics?

本小妞迷上赌 提交于 2019-12-01 21:54:29
I am currently trying to get the rotation of an object. I am using C++ and Bullet Physics. This is my code: btScalar x, y, z; body[0]->getCenterOfMassTransform().getBasis().getEulerZYX(z, y, x); However, as I rotate the object around clockwise the number I get from the y (y is vertical in Bullet) axis goes from 0 to -90 to 0 to 90 and finally back to 0 for every quarter rotation. It is close but what I need is for it to go all the way from 0 to 360. Bullet documentation says: void getEulerZYX (btScalar &yaw, btScalar &pitch, btScalar &roll, unsigned int solution_number=1) const and solution

Avoid ground collision with Bullet

独自空忆成欢 提交于 2019-11-28 19:00:52
I'm trying to use Bullet physic engine to create a 3D world. I've got my character with a Capsule shape on his body and my ground his made of some static blocs stick together, here is a schema to illustrate my words: The problem is present when my character run from one block to another: Bullet detect a collision and my character start to jump a little bit on y-axis. How can I avoid the problem? What I did to overcome this issue is the following: Instead of have the capsule slide on the ground, I had a dynamic capsule ride on top of a spring. I implemented the spring as several ray casts