Hey, I posted on the Irrlicht boards, but had no help with my problem. I've googled around and couldn't find answers either, so i figured I'd try to see if the Bullet community could help me out.
Not sure if y'all deal with irrBullet, but I figured it was worth a shot. Here's my original post from those boards:
hey, i'm new to the forums. I am currently enrolled in a university as a comp sci major, and have been messing around with the irrlicht engine rendering some models I've created years ago. I've been having fun with the engine and I've been wanting to try something more exciting.
So far my "project" creates a human (mesh) and has it stand on top of a small box (built like a plane). I've been able to code him to move around using wasd, but I was only using set position on the node, so it never detected any collision.
Then I looked into irrBullet because I didn't want to write my own [crappy] physics engine. So now the program runs and creates the collision triangles on my models (i think that's the right term...haha) using a triangle mesh collision thing or something like that? Anyway, the collision detection is just superb, but I can't figure out how to use it in order to create movement with my hero using the keyboard. I just want a small demo where i can have him run around on the plane using wasd.
I looked into IKinematicCharacterController, but i really can't find much on it. I just downloaded it from the SVN trunk, but couldn't get it to recognize it, saying it wasn't declared in this scope. That leads me to believe that I need to recompile the irrBullet files to have the IKinematicCharacterController or something? I couldn't get the btKinematic one working either. Everything else in irrBullet/irrlicht seems to be working fine though!
Does anyone have any suggestions or help you could provide me with? The engine is awesome, and I'd love to be pointed in the right direction for some solutions. Thanks!
Edit: After looking around a bit, it seems like this guy (who said the movement function wasn't working) had the same problem as me. Anyway, they told him to recompile irrBullet based on the SVN? Is that what I need to do? How can I go about doing that? http://irrlicht.sourceforge.net/forum/v ... ic#p261348
I would either make my own character controller from a non rotating capsule that hover a bit over the ground to climb stairs or make a rag doll that can walk with a little help from invisible forces.
CookieMonster wrote:I would either make my own character controller from a non rotating capsule that hover a bit over the ground to climb stairs or make a rag doll that can walk with a little help from invisible forces.
SOLVED wrote:hmm, alrighty. Well I've started trying to do something of that sort.
As of right now, I have a bool array for each key, which is true when the key is down and false if otherwise. It runs forward (on the Z value) when W is pressed. A and D successfully rotate the character by setting a Angular Velocity on the rigid body. W and S move the character the same way using Linear Velocity on the rigid controller. I've having just one problem now.
I'm trying to get my character to run forward based on its rotation around the Y-axis (its facing direction).
So I did cos and sin and that's all working fine and dandy for the top half of my circle. So basically 0-90 degrees and 270-360 degrees are both working.
However, the bottom half, isn't. I was wondering why and wasn't sure if I did the math wrong, so I had the window constantly display the Y rotation of my mesh on the title bar thing of the main window. It seems as though the right half of the circle (pi/2 to -pi/2) goes from 0 to 90 and then 90 back to 0, rather than 0 to 180.
The opposite side of the circle (pi/2 to 3pi/2) goes from 360 to 270 back to 360.
Do you have an idea of what would cause this behavior, or how I could possibly fix the rotation angles for my calculations?
ps: I am correctly changing the values from degrees to radians during the trig functions since the top half of directions work fine.
Edit: Nevermind, I may have found my
Solution. I read that I need to rotate using a matrix or something? How would I go about doing that?
Also another note, what's the best combination for a character with a custom terrain mesh? Should both us the btVhTriangleMesh thing or whatever it's called? What's the best approach? Last time I tried, my model fell through the loaded terrain mesh.
Edit again: well, I figured out the rotation thing! Now my only problem is the terrain mesh collision and the character mesh's collision. Any thoughts?
Also another note, what's the best combination for a character with a custom terrain mesh? Should both us the btVhTriangleMesh thing or whatever it's called? What's the best approach? Last time I tried, my model fell through the loaded terrain mesh.