bullet

Bullet debug drawer with OpenGL

情到浓时终转凉″ 提交于 2020-02-01 08:27:09
问题 I have been fiddling around with bullet for a bit and I now want to draw debug. I have an opengl world with working bullet physics and everything. What I have tried is this: I have created a class GLDebugDrawer like this: #include "LinearMath/btIDebugDraw.h" class GLDebugDrawer : public btIDebugDraw { int m_debugMode; public: GLDebugDrawer(); virtual ~GLDebugDrawer(); virtual void drawLine(const btVector3& from, const btVector3& to, const btVector3& fromColor, const btVector3& toColor);

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

半世苍凉 提交于 2019-12-31 02:29:08
问题 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. 回答1: Bullet documentation says: void

How to apply rotation to a body in Bullet Physics Engine?

烈酒焚心 提交于 2019-12-14 01:21:22
问题 I have rotation values (roll, pitch, yaw). I would like to apply that rotation to a body, but I have no idea how to do that. 回答1: The most straightforward way would be to directly set the world transform for a rigid body, either through a motion state or by direct setting. To get a transform from roll, pitch, and yaw, you could use: btRigidBody * rigidBody = //... btTransform tr; tr.setIdentity(); btQuaternion quat; quat.setEuler(yaw,pitch,roll); //or quat.setEulerZYX depending on the

BulletPhysics (ammo.js) - How would you go about applying force to an object?

微笑、不失礼 提交于 2019-12-12 04:49:10
问题 To clarify - ammo.js is a port of Bullet Physics using mscripten I have a character (essentially a block) that needs to be pushed with force. I have tried (I think) all of the methods for forces but I still cannot move the block. setVelocity(1,0,0) does not even move the block - it just stops gravity from acting on it! applyImpulse([0,0,200000],[0,0,0]) does absolutely nothing. applyForce([0,0,200000],[0,0,0]) does absolutely nothing. 回答1: Due to the fact that ammo.js is an emscripten port,

how to destroy an item after collision

我的未来我决定 提交于 2019-12-11 04:18:13
问题 I am creating an fps game, I have created the gun, the bullet, and the enemy. Now I want to make my enemy destroyed after the collision with bullet. My enemy is a gameobject named Fire and tagged Enemy and my bullet named "Cube 1(Clone)" and tagged "Cube 1(Clone)". I made a script for that: #pragma strict function OnTriggerEnter(theCollision : Collider) { if(theCollision.gameObject.name=="Cube 1") { Destroy(gameObject); Debug.Log("Dead"); } } But it does not work. 回答1: You need to check the

Scaling a ModelInstance in libgdx 3D and Bullet engine

拟墨画扇 提交于 2019-12-08 12:56:21
问题 Everytime I try to add a resized ModelInstance of a Model (made in 3ds max) to a Bullet world, I keep getting the same model, with no modified scale. This is my current code: Objeto objmat = mapaactu.nameAndPutObjetos(obj.getMaterias().get(0).nombreasoci,(int)obj.getMaterias().get(0).cantidad); world.addConstructor(objmat.nombreinterno, objmat.constructor); Vector3 objmatpos = new Vector3(obj.entidadbody.getWorldTransform().getTranslation(Vector3.Zero)); Vector3 scala = new Vector3(obj

find a way of fixing wrong collision normals in edge collisions

早过忘川 提交于 2019-12-08 05:57:37
问题 The main problem is that Bullet 2 (2.82, to be specific - and perhaps Bullet 3 too, haven't checked it yet) processes edge collisions lousily, generating skewed reaction normals. Test case 1: a small btBoxShape , positioned (0,9,0), aligned vertically, falls onto another box's (made from btBoxShape also) face, coaligned. The normal is computed properly, the collision happens only in Y (vertical) axis. The box slightly bounces on OY axis and stays centered around it. Test case 2: a small box,

Bullet debug drawer with OpenGL

試著忘記壹切 提交于 2019-12-04 19:06:57
I have been fiddling around with bullet for a bit and I now want to draw debug. I have an opengl world with working bullet physics and everything. What I have tried is this: I have created a class GLDebugDrawer like this: #include "LinearMath/btIDebugDraw.h" class GLDebugDrawer : public btIDebugDraw { int m_debugMode; public: GLDebugDrawer(); virtual ~GLDebugDrawer(); virtual void drawLine(const btVector3& from, const btVector3& to, const btVector3& fromColor, const btVector3& toColor); virtual void drawLine(const btVector3& from, const btVector3& to, const btVector3& color); virtual void

How to apply Bullet physics to drawn Opengl 3d shapes

戏子无情 提交于 2019-12-03 13:07:52
问题 I was just wondering whether there is a way to apply bullet physics to opengl drawn objects (created using glVertex3f or triangle mesh with glVertexAttribPointer). I am currently using jogl and jbullet to apply physics to my 3D objects. Specifically if I give a buffer of vertices for a triangle mesh shape for the 3d object. I need Bullet to create a CollisionShape based on the triangle mesh shape, and apply the physics to it, which at the same time apply physics to the drawn opengl objects.

How to apply Bullet physics to drawn Opengl 3d shapes

我的梦境 提交于 2019-12-03 03:18:57
I was just wondering whether there is a way to apply bullet physics to opengl drawn objects (created using glVertex3f or triangle mesh with glVertexAttribPointer). I am currently using jogl and jbullet to apply physics to my 3D objects. Specifically if I give a buffer of vertices for a triangle mesh shape for the 3d object. I need Bullet to create a CollisionShape based on the triangle mesh shape, and apply the physics to it, which at the same time apply physics to the drawn opengl objects. At the moment, the physical collision shape may move (in bullet), but the drawn opengl shape is not.