This easy-to-read-and-follow one of a kind book on BlitzMax game programming also covers some 3D programming. BlitzMax for Absolute Beginners includes game application projects such as The Great.
Hello; this is my first post so please take it easy on me I have recently switched to C / Pullet from a combination of BlitzMax / ODE.I want to start by showing what I'm trying to achieve. Here is a quick video of a first person hockey game where a character ends up being toppled by various means and always pushes back up to a standing position:I was able to achieve this by applying torque to a rigidbody on BlitzMax because the ODE library came with Pitch/Yaw/Roll (0-360) retrieval built in, which I'm entirely comfortable with. I could use how far the character's pitch and roll were from zero (upright) when applying torque to achieve a standing up state and eventually built in measures to not overshoot.I think you know where I'm going with this; I've entered the world of transforms & quaternions and I'm lost. I have scoured this forum and found similar posts about applying various forces to keep a rigidbody upright, and I've tried to find information with regards to retrieving / converting what bullet provides to Pitch Yaw and Roll. I've tried and tried so many examples and everything I've produced either flat out doesn't work properly or starts acting strangely once a rigid body's yaw goes 90 degrees in either direction.I'm hoping that someone can help me along with this either via pseudocode or real code to demonstrate what I'm actually looking for.
The character in the example above is built with a collection of spheres (I've accomplished this with btCompound). The part I don't understand how to do with this combination of tools is making the character stand up without affecting the yaw rotation. I don't know if it's possible to retrieve 360 degree Pitch/Yaw/Roll vectors with Bullet or if there is possibly a much better method at achieving this behavior.
At this stage I'm happy to admit I'm a bit ignorant on the subject; but I've spent many days researching and trying.It seems I've been able to learn so much but I don't even know where to begin here Thank you for your time. Here is how I would do it:Rather than apply impulse I would implement a custom 'action' (e.g. Derive UprightCharacterAction from btActionInterface) which behaves like an 'angular spring' and slams the velocity of the character toward an upright position. The main reason I don't like to operate in impulse space is because the impulse required to achieve a desired deltaAngularVelocity must be scaled by the inverse inertia tensor, else you get odd results and even instabilities.So your UprightCharacterAction class might look something like this. Code: uprightAction.setSpringTimescale(timeToGetUp / 3.0);The reason is because the timescale dictates exponential decay and the delta angle decreases to 1/e of its original value after each timescale.
After three timescales the delta angle would be (1/e)^3 which is pretty small.The mblendTimescale is used to prevent the upright behavior from completely overwriting whatever current angular velocity it already has, since otherwise the action would completely erase any external bumps. If you make springTimescale very short but the blendTimescale longer then you tend to get a bouncy spring. If you make the blendTimescale very short then you just get the exponential decay of the spring and all external bumps tend to get 'erased'. Tuning this value is a little trickier. My advice: set it to the mspringTimescale and then adjust up/down to see how it affects things.Finally I will mention how the btActionInterface works: In this specific example you would need to instantiate one UprightCharacterAction, passing it a pointer to the RigidBody on which it is supposed to act, and then give it to the world.
Thank you for your help with this drleviathan! I haven't been able to get the action itself working, but by isolating the meat of it I was able to get it working and boy does it work perfectly (in fact, it is much more stable than my old method of using torque)!
I still don't fully understand why it works, but you have given me enough to start studying and thinking about this problem differently.I will look further into how the btActionInterface works to get that working. A couple of questions:a) Are there any guides or tutorials out there that you would recommend to understand this different way of thinking? For many years I've always used Pitch/Yaw/Roll to figure these types of things out. When it comes to transforms / quaternions I'm lost, but I'm beginning to see the light and why it's better to go about my business using them.b) Using ODE I was able to use CFM on rigidbodies to allow various amounts of penetration between rigidbodies (softer collisions but not softbody collisions). Does bullet have anything like this?
I understand that in most cases this is not something that would be desired, but in my case there are some neat things that can be done with this. An example can be provided if I'm not describing this very well. If you have Quaternion or 3D math questions you can ask on this forum or on the live IRC channel on freenode.When it comes to how my example works I can offer this insight:Assume the displacement has an exponential decay time function of the form x(t) = X. exp(-t / tau) where tau is the timescale.From calculus class we know: velocity is the first derivative of displacement. Fortunately the derivative of an exponential curve is very simple: has the same form except for a different constant out front.v(t) = d/dt x(t)v(t) = X. d/dt exp(-t / tau)v(t) = - (1 / tau). X.
exp(- t / tau)v(t) = - (1 / tau). X(t)That is why: if you know the displacement at some time t AND you assume exponential decay then you can easily calculate the velocity at time t that would make it so: you just multiply by 1/tau and make sure it is pointing in the correct direction. By forcing the velocity toward the assumption the displacement behaves in the assumed manner.Aside from the 3D math stuff that is all there is to the algorithm.I do not know what CFM means.
Perhaps you're asking about changing the material properties such as restitution and friction? If so, yes the RigidBody supports such properties.
The performance in 2007 is not as good as 2006. I'm wondering what I coulddo to improve it with out spending to much.
I know the spec of the computerare on the bottom end, so were should I spend the money at to get the mostbang for my buck? I do mostly 2d work and in that world the computer worksfine. I do some 3d work and in 2006 it was ok but in 2007 things are way toslow.
The biggest 3d file I have now is about 2mb. From the AutoCAD web page Features and Specs link:'System requirements for AutoCAD 2007 for users who aretaking advantage of the new conceptual design capabilitiesare as follows:a. IntelĀ® processor 3.0 GHz or greaterb. Windows XP Professional (SP2)c.
2 GB RAM or greaterd. 2 GB of disk space available, not includinginstallatione. 1280x1024 32-bit color video display adapter (truecolor)f. 128 MB or greater, OpenGLĀ®-capable workstation classgraphics card.SaadallahAdd-on products for LThttp://www.pendean.com/lt.
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
March 2023
Categories |