irrBullet 0.1.8 - Bullet physics wrapper

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Post by Virion »

how to move an object without accelerating and decelerating? sorry i'm new to game physics.
cobra
Posts: 371
Joined: Fri Jan 23, 2009 2:56 am
Location: United States
Contact:

Post by cobra »

Virion:

Code: Select all

irr::matrix4 mat = rigidbody->getWorldTransform();
mat.setTranslation(irr::core::vector3df(20,20,20));

rigidbody->setWorldTransform(mat);
Josiah Hartzell
Image
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Post by Virion »

thx for the help cobra. now i'm trying to rotate my object when i pressing a button. it works fine at first but when it reaches 90 degree it won't rotate anymore.

Code: Select all

matrix4 mat = body->getWorldTransform();
vector3df rot = mat.getRotationDegrees();
mat.setRotationDegrees(rot - vector3df(0, 1 * speed, 0));
body->setWorldTransform(mat);
thx in advance :oops:
Brainsaw
Posts: 1183
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Post by Brainsaw »

Sounds like a gimbal lock to me (an issue that did cost me about a week to workaround in IrrOde).

In IrrOde it works like this: when a Gimbal Lock is detected the Irrlicht scenenode's rotation is not updated (Gimbal locks are a problem of the Euler angles, quaternions don't have such problems).
Dustbin::Games on the web: https://www.dustbin-online.de/

Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Zurzaza
Posts: 153
Joined: Fri Mar 26, 2010 9:41 pm
Location: Filo (FE), Italy
Contact:

Post by Zurzaza »

cobra wrote:Virion:

Code: Select all

irr::matrix4 mat = rigidbody->getWorldTransform();
mat.setTranslation(irr::core::vector3df(20,20,20));

rigidbody->setWorldTransform(mat);
it won't work if the body isn't set as kinematic body. In order to move an object "legally" into the bullet world is to set it as kinematic body
irrBP - an Irrlicht - Bullet Physics Wrapper.
The only irrlicht-physics wrapper that uses multithread technology.
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Post by Virion »

Zurzaza wrote:
cobra wrote:Virion:

Code: Select all

irr::matrix4 mat = rigidbody->getWorldTransform();
mat.setTranslation(irr::core::vector3df(20,20,20));

rigidbody->setWorldTransform(mat);
it won't work if the body isn't set as kinematic body. In order to move an object "legally" into the bullet world is to set it as kinematic body
weird. i set my body to kinematics and it won't work anymore.

Code: Select all

body->setCollisionFlags(ECF_KINEMATIC_OBJECT);
then i set it back to character object and it works again. but still the rotation is locked at 90 degree.
Zurzaza
Posts: 153
Joined: Fri Mar 26, 2010 9:41 pm
Location: Filo (FE), Italy
Contact:

Post by Zurzaza »

Virion wrote: weird. i set my body to kinematics and it won't work anymore.

Code: Select all

body->setCollisionFlags(ECF_KINEMATIC_OBJECT);
then i set it back to character object and it works again. but still the rotation is locked at 90 degree.
hmm..it looks very strange.
From the bullet official manual (p.22), it only says that kinematic bodies can be animated by te user:

Kinematic rigidbodies: can be animated by the user, but there will be only one-way interaction: dynamic objects will be pushed away but there is no influence from dynamics objects
So, i can't explain why your object can be moved
irrBP - an Irrlicht - Bullet Physics Wrapper.
The only irrlicht-physics wrapper that uses multithread technology.
cobra
Posts: 371
Joined: Fri Jan 23, 2009 2:56 am
Location: United States
Contact:

Post by cobra »

Zurzaza:

It most certainly can be positioned without first being set to kinematic.

You misunderstood what the documentation says.

Kinematic objects are useful for things like character controllers, because they will affect dynamic objects but will themselves not be affected.


Virion:

I'll have to look in to your problem when I have more time. Sorry.
If you figure it out before then, please let me know.
Josiah Hartzell
Image
griffin2000
Posts: 22
Joined: Mon Nov 15, 2010 9:18 pm

Post by griffin2000 »

Looks very cool. Apologies if I'm being dense, but how do you go about building it on Visual Studio ?

I see some CMake files further down in the source tree (in some of the sub folders of irrBullet-0.1.65\source\bheaders\Bullet\BulletCollision) but nothing in the root Source folder.
cobra
Posts: 371
Joined: Fri Jan 23, 2009 2:56 am
Location: United States
Contact:

Post by cobra »

griffin2000:

I believe I posted some light instructions in previous pages of this thread.

Also, irrBullet 0.1.7 will have Visual Studio project files and pre-built libs.
Josiah Hartzell
Image
Leo [Teh one]
Posts: 6
Joined: Sun Sep 05, 2010 3:08 pm

help needed!

Post by Leo [Teh one] »

---problem solved---
cobra, thanks for so cool wrapper!
Last edited by Leo [Teh one] on Sun Nov 21, 2010 6:22 pm, edited 2 times in total.
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Post by ent1ty »

Virion wrote:thx for the help cobra. now i'm trying to rotate my object when i pressing a button. it works fine at first but when it reaches 90 degree it won't rotate anymore.

Code: Select all

matrix4 mat = body->getWorldTransform();
vector3df rot = mat.getRotationDegrees();
mat.setRotationDegrees(rot - vector3df(0, 1 * speed, 0));
body->setWorldTransform(mat);
thx in advance :oops:
The problem with this is, that getWorldTransform() returnd wrong rotation. My workaround was, to store the rotation manually in a variable, instead of getting it from the body

Code: Select all

int RotY= 0;
IRigidBody* Body;

...

void rotate(float degrees)
{
    rotY+= degrees;
    matrix4 mat= body->getWorldTransform(); //we get the transform, just to get correct translation and won't use the rotation from it
    mat.setRotationDegrees(vector3df(0, rotY, 0));
    body->setWorldTransform(mat);
}
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps

Step back! I have a void pointer, and I'm not afraid to use it!
cobra
Posts: 371
Joined: Fri Jan 23, 2009 2:56 am
Location: United States
Contact:

Post by cobra »

You could also try changing "vector3df rot" from mat.getRotationDegrees() to

Code: Select all

body->getCollisionShape()->getSceneNode()->getAbsoluteTransformation().getRotation()

I'll fix this for 0.1.7. Apparently copying over OpenGL matrix from Bullet to Irrlicht doesn't have the right rotation, but from Irrlicht to Bullet it does.
Josiah Hartzell
Image
Birdman
Posts: 25
Joined: Mon Jan 28, 2008 5:45 am
Location: Buenos Aires

Problem compiling

Post by Birdman »

This files gives me trouble in Softbody.h:
#include <map.h>
#include <vector.h>
Both files seems to be missing, maybe i did something wrong?

This happens to me with 1.65 only.
The sleeper must awaken!
cobra
Posts: 371
Joined: Fri Jan 23, 2009 2:56 am
Location: United States
Contact:

Re: Problem compiling

Post by cobra »

Birdman wrote:This files gives me trouble in Softbody.h:
#include <map.h>
#include <vector.h>
Both files seems to be missing, maybe i did something wrong?

This happens to me with 1.65 only.

Change map.h to just map, and vector.h to just vector.


This is already fixed for 0.1.7, which will be out by January 5th.
Josiah Hartzell
Image
Post Reply