irrBullet 0.1.8 - Bullet physics wrapper

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Barratator
Posts: 30
Joined: Fri Jan 08, 2010 3:30 pm

Post by Barratator »

I tried to use irrBullet with VC++ (2010).
Currently I can use some functions of irrBullet. It's possible to call createIrrBulletWorld and use a few functions of it like "setGravity".

But when I'm want to use stepSimulation of the irrBulletWorld, there is a linker error:

Code: Select all

error lnk2019: unresolved external symbol "public: int __thiscall irrBulletWorld::stepSimulation(float,unsigned int,float)"
But as far as I can see, the stepSimulation-function is exportet with my irrBullet.lib (there is a string "stepSimulation" in the *.lib-file when i'm open it with Notepad).

I already tried the precompiled lib-File of the 2008 directory, of the 2010 directory and a self-compiled version.

Any ideas? :S


Thanks!



EDIT: I recompiled irrbullet a few times with different options...now it works! :)
Last edited by Barratator on Thu Jun 02, 2011 8:15 pm, edited 1 time in total.
Rocko Bonaparte
Posts: 48
Joined: Tue Aug 31, 2010 6:27 am

Post by Rocko Bonaparte »

My problem with spin turned out to be something pretty bizarre when I started looking at the whole rotation vector for the Irrlicht node that was being affected by the physics engine. From 0 to ~90 -- whether it was 89.99999 or 90.0 I am unsure--the rotation around the Y axis was as expected, but after 90 degrees X and Z got flipped and Y started to decrement. Something like this as I rotated clockwise:

(0, 0, 0) ...
(0, 30, 0) ...
(0, 60, 0) ...
(180, 90, 180)...
(180, 60, 180)...
(180, 30, 180)...

The effect was that it did continue to spin around properly but it really screwed up me figuring out if it was pointing the in the right direction. I have tabled that for now in use of faceTarget.

It looks like IRigidBody::faceTarget is an irrBullet exclusive. I am having a little bit of odd trouble with it. I am trying to make an enemy face the player, so I figure I'd have the enemy face the position of the player. But this doesn't seem to work well--especially when they get close to each other. It's like it gives up the closer they are. What I did instead was get the 2d X,Z direction to the player, normalize that, and subtract the X, Z components from the enemy's current position. For some reason that works (not sure what adding them wasn't working, but it pointed the opposite way).

I am assuming I have some matrix stupidity going on that I need to correct. Here's what the enemy object's world transform was from getWorldTransform()

-0.707107, -0, 0.707107, 0,
-0, 1, -0, 0,
-0.707107, -0, -0.707107, 0,
5, 10, 5, 1,

Initially positioned at (5, 10, 5), rotation set to (0, 0, 0), and scale set to (0.33, 0.33, 0.33). The world as I am trying to set it up has +Y as up (0, 1, 0). Gravity is (0, -9.8, 0).

I am wondering if I am doing something naive with my matrices because of these goofy little problems.

Edit: Well for the whole pointing backwards thing I assume there's something backwards in faceTarget:

Code: Select all

    matrix4 mat = body->getWorldTransform();
    vector3df rot, dif = mat.getTranslation() - targetPosition;
    rot.Y = atan2( dif.X, dif.Z ) * 180.f / irr::core::PI;
    rot.X = atan2( dif.Y, sqrt( dif.X * dif.X + dif.Z * dif.Z ) ) * 180.f / irr::core::PI;
    mat.setRotationDegrees(rot);
    body->setWorldTransform(mat);
Particularly mat.getTranslation() - targetPosition. Might these need to be reversed? I just followed the math through. Say the object is at (5, 10, 5) and I want it to face (0, 10, 0). dif will be set to (5, 0, 5), which will calculate an angle of 45 degrees. However, I would have preferred an angle of 225 degrees or -135 degrees depending.

The oddball stuff that was happening came about when I was trying to flip the X and Z components of the target location to try to flip it around. I understand now why that wouldn't work because that flip changes, say a target of (5, 0, 5) to (-5, 0, -5) which is only going to work if the body is at (0, 0, 0). So now I see why my normalized direction vector worked better.
lazerblade
Posts: 194
Joined: Thu Mar 18, 2010 3:31 am
Contact:

Post by lazerblade »

lazerblade wrote: Now i'm getting good old fashion __gxx_personality_sj0 not found errors and stuff like that. I'm guessing that makes this a problem with the standard library or my projects lack of ability to find the standard library, and not an IrrBullet problem.

Well I finally got this solved. How did I solve it? I simply recompiled Irrlicht, Ray3D, Bullet, and IrrBullet with my version of GCC. Apparently there was either some kind of version non-backward-compatibility, or some problem with the way they had been compiled.

At any rate, it works. And to future problem havers, remember to recompile everything on your HD every time you need to link with a new lib. :lol:
LazerBlade

When your mind is racing, make sure it's not racing in a circle.

3d game engine: http://sites.google.com/site/lazerbladegames/home/ray3d
lazerBlade blog: http://lazerbladegames.blogspot.com/
Barratator
Posts: 30
Joined: Fri Jan 08, 2010 3:30 pm

Post by Barratator »

Hello,
i set the gravity of the world to 0,-10,0.
But all rigid-bodys (with a mass > 0) fall down with a linear speed, not exponential.
Is there any option to let them fall down with an exponetial speed?

Thanks!
Bastian
cobra
Posts: 371
Joined: Fri Jan 23, 2009 2:56 am
Location: United States
Contact:

Post by cobra »

Rocko Bonaparte:

IRigidBody::faceTarget() was actually an experimental method, but long since then I have an improved version of that for something else. I will convert it to work with irrBullet when I can.


Barratator:
That's something you'll probably have to ask Erwin Coumans. Sorry.


- Josiah
Josiah Hartzell
Image
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Post by serengeor »

Barratator wrote:Hello,
i set the gravity of the world to 0,-10,0.
But all rigid-bodys (with a mass > 0) fall down with a linear speed, not exponential.
Is there any option to let them fall down with an exponetial speed?

Thanks!
Bastian
They do fall at with exponential speed, just try resetting your body's position once its falling and you'll see it trying to move more and more.

It might be scaling issues.

Did you even try printing out Y value of linear velocity?
Working on game: Marrbles (Currently stopped).
Barratator
Posts: 30
Joined: Fri Jan 08, 2010 3:30 pm

Post by Barratator »

Now I'm set a position with set setWorldTransform() on the rigidbody.
The figure start now 100 units higher than before, but it's the same.

I "debug" the speed with getPosition() on the ISceneNode. It needs all the time 3-4 bullet-steps to fall down one unit.



Bastian
RdR
Competition winner
Posts: 273
Joined: Tue Mar 29, 2011 2:58 pm
Contact:

Post by RdR »

Is there a way to disable and enable a raycast vehicle?
Barratator
Posts: 30
Joined: Fri Jan 08, 2010 3:30 pm

Post by Barratator »

Is it intended to support capsule-objects in the next time?


Bastian
Rocko Bonaparte
Posts: 48
Joined: Tue Aug 31, 2010 6:27 am

Post by Rocko Bonaparte »

cobra wrote:Rocko Bonaparte:

IRigidBody::faceTarget() was actually an experimental method, but long since then I have an improved version of that for something else. I will convert it to work with irrBullet when I can.

- Josiah
I'll say right now it's working fine for me. I haven't tried to do something more sophisticated yet using angular momentum or something else but I probably should to be more consistent with the physics world. Since the time I was messing around with all that, I learned about using atan2, and also Irrlicht's own methods for getting a direction vector from a rotation vector.

I have a general problem I'm trying to solve and I'm not sure what approach to take. I'm trying to set up a scenario where during a range of frames in a melee attack animation, I test for collision in the general area in front of an attacking character. I have the choreography down but I am not sure how to do the collision tests. I am creating a sphere node in Irrlicht with zero radius and zero faces, to which I create a rigid, massless sphere body. Unfortunately this body influences physics for the things it touches. I had hoped I could use it for testing collisions instead. I am generally wondering what's the best way to approach this problem.

Edit: I think what I need are ghost objects. It looks like those aren't wrapped at all so I will have to do some things to get them crammed in.
Rocko Bonaparte
Posts: 48
Joined: Tue Aug 31, 2010 6:27 am

Re: irrBullet 0.1.71 - Bullet physics wrapper

Post by Rocko Bonaparte »

Cobra,

I started writing an IGhostObject wrapper but I'm struggling with making it play nice with irrBullet. It's putting all the ghost objects at the origin. I'm kind of wondering if I need to delve into your motion states or some other constructs to hook up everything. I can send along what I have so far if you want to try to start merging in ghost objects. I'm hoping since you're a little bit cozier with your internals and Bullet normally that you'll be able to get that last mile. I'm still trying to figure it out so I'll want from you before posting anything; it's prone to being changed otherwise.
Barratator
Posts: 30
Joined: Fri Jan 08, 2010 3:30 pm

Re: irrBullet 0.1.71 - Bullet physics wrapper

Post by Barratator »

Hello,
is there any possibility to "move" the SceneNode of an rigidbody away from the central-point of a shape?
When i'm creating a rigid the scenenode is at the same point as the shape, but the collision-box of the object should be at another point.


Bastian
smso
Posts: 246
Joined: Fri Jun 04, 2010 3:28 pm
Location: Hong Kong

Re: irrBullet 0.1.71 - Bullet physics wrapper

Post by smso »

You may parent the scene node to an empty scene node and use the empty scene node to set up the irrbullet rigid body. Then you may position the scene node as you like.
hotmirror
Posts: 2
Joined: Fri Jun 10, 2011 3:24 pm

Re: irrBullet 0.1.71 - Bullet physics wrapper

Post by hotmirror »

Hello!
First of all sorry for my bad english, I'm from Germany :)
I have a little Problem with collisions when I move my character. I calculate the move-direction with

Code: Select all

newplayerpos.Z -= cos(grad2rad(newplayerrot.Y))*(MOVESPEED * frameDeltaTime);
newplayerpos.X -= sin(grad2rad(newplayerrot.Y))*(MOVESPEED * frameDeltaTime);
and then I move my Character with

Code: Select all

matrix4 dir;
dir.setRotationDegrees(newplayerrot);
newplayerpos.Y = PlayerNode->getAbsolutePosition().Y;
dir.setTranslation(irr::core::vector3df(newplayerpos.X, newplayerpos.Y, newplayerpos.Z));
rigidbody->setWorldTransform(dir);
The collision with the ground works fine, but my character can walk through the walls, so he doesn't collide with the walls..
I think it has to do with

Code: Select all

rigidbody->setWorldTransform(dir);
?

Maybe you know another way to move my character so that he collide with the walls of my level.
Or do I have to check every frame wether my character collided with a wall and then stop moving?
I hope for some replies and i hope also that my english was not too bad :D !
Thanks!
soulless
Posts: 25
Joined: Mon Jan 11, 2010 6:06 am

Re: irrBullet 0.1.71 - Bullet physics wrapper

Post by soulless »

hotmirror wrote:Hello!
...

Maybe you know another way to move my character so that he collide with the walls of my level.
Or do I have to check every frame wether my character collided with a wall and then stop moving?
I hope for some replies and i hope also that my english was not too bad :D !
Thanks!
The player collides, but it never get stop because you are forcing a new position manually, that's the problem I have right now, idealy the movement must be done by applying impulses, but I'm having problems with my player getting stuck in the ground.
Post Reply