Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

123 Neutral

About peter86

  • Rank
  1. I really can't decide what collision library to use since neither of them has all the features I'd like. Problem is that I need to update the collision meshes every frame for animated models and still be able to perform ray-intersect tests for hit testing. OPCODE is the most robust lib IMO but this is optimized for static models and gives too big performace loss rebuilding the collision meshes every frame. SOLID is a bit slower and not as memory friendly. However it can be use to update the vertices pretty efficiently, but I'll lose the ability to perform a ray-intersect test. What would you have done? Is there any other nice libraries out there? I'm sure there's lots of people who have found a solution to this problem and all of 'em didn't write their own collision testing functions right? :)
  2. peter86

    PhysX collisions

    Well, solved it - PhysX doesn't support trimesh-trimesh collisions.
  3. peter86

    PhysX collisions

    I've made a simple physics implementation using PhysX. My only problem is that the actors traver right through each other instead of bouncing off when they collide. Standard shapes works just fine but when it comes to cooked triangle meshes it doesn't work although the collision shapes seems fine. Any ideas of the cause? [Edited by - peter86 on January 3, 2007 8:24:52 AM]
  4. peter86

    Angular acceleration of car

    Quote:Original post by CombatWombat http://www.engineering.com/content/ContentDisplay?contentId=41005050 From here, I think I would use the formula for moment of inertia about axis Yc. See what sort of number you end up with. But if it is behaving well now, then perhaps the original value was simply too low. IS...it behaving well now? Well, I ended up with a value of 1400 kgm, that's less than one sixth of the 9000 kgm I'm using but it's for a box though. I can't find anything strange in my calculation and it's behaving quite well now, just need a few adjustments so I think I'll stick with the 9000 kgm. Thanks for your help anyway! :)
  5. peter86

    Angular acceleration of car

    Quote:Original post by CombatWombat It's odd the car rotates very quickly at high speeds. It is possible your tires are just waaaay too sticky, or that you are calculating the side forces in a strange manner. It is also possible that the front/rear balance favors the front too much, which would make the back kind of slide around. I've had no problems using the inertia for a typical rectangular box, so you should not have to arbitrarily increase it very much to make it driveable. Say you are steering left, the front tires should create a force to the left. This will also create a moment making the car try to rotate counterclockwise. This should build up the slip ratio in the rear tires so that they also create a force to the left (so all 4 tires are pushing towards the inside of the radius of curvature, otherwise you wouldnt change direction!). Note however, that the moment created by the rear tires will try to rotate the car CLOCKWISE. It fights the rotation from the front tires. It is therefor hard to relate the angular rotation of the car with speed, since it is a function of what the tires are doing (which can be very complicated to follow. You just have to work through the model and see that each piece makes sense). If you can provide more information on how your tire model derives its forces, that may lead us to a definitive answer as to your rotation problem. The tires are delivering a bit too much force at greater slip angles, maybe twice as much as they are supposed to since I implemented the force proportional to the slip angle. I'm gonna change that later though. Could you provide me with some "normal" interia value, just to let me know what's reasonable. I've set it to 9000 kgm now. That's just what I'm doing, calculating the torque of the front wheels and subtracting the torque of the rear ones. I'm also using a 50/50 static weight distribution so that shouldn't be any problem. Basically I've fallen back the demo of this tutorial: http://home.planet.nl/~monstrous/tutcar.html, but I had to increase the inertia to make it behave naturally.
  6. peter86

    Angular acceleration of car

    Quote:Original post by CombatWombat Ok, so you are using the tire forces to rotate the car then. That is good. The tires are the only thing telling the body of the car what to do. I dont understand what you mean in the second part about 'too slippy results'. Oversteer? Simply making huge-radius corners? You WILL make large radius turns as the speed increases. The inertia should not change with velocity, so you are probably doing that bit right... What it comes down to, then, is the tire model. This determines 90% of the behavior of any PC racing game. Pacejka is a complicated bit, probably overcomplicated and I havnt found it to produce results any better than creating your own slip angle and ratio curves (assuming you can come up with a good way to combine them, which is harder still). The idea is that you want the force to increase with slip angle up to a certain point, then pretty much platuea off. Maybe dropping a little bit in some instances. There isnt really any relation to vehicle speed here. Are you simulating weight transfer and multiplying the load in for your tire forces? What if you added downforce, that would provide more grip at high speeds and maybe help with the "slippery" action you are noticing? I meant that the car makes quite small-radius corners at higher speeds since the angular acceleration is the same, this makes the car very hard to control while cornering since it will just slip aside. I haven't implemented any weight transfer yet so I'm just using a static load. This slippery is experienced already at speeds about 10 m/s and these speeds shouldn't generate any remarkable downforce. Anyway I think I've solved it now by increasing the inertia quite a bit. So greater speeds shouldn't reduce the angular acceleration? However the steer angle must be limited or accelerating in some way at higher speeds. No one would probably turn the wheel to the maximum possible at those speeds. Does anyone have any suggestions of how fast the steer angle should increase when cornering at higher speeds? And should I limit it to a maximum angle at a given speed? [Edited by - peter86 on November 2, 2005 12:46:05 PM]
  7. peter86

    Angular acceleration of car

    Quote:Original post by CombatWombat Depends. How are you simulating the tire forces? If you are using curves to represing slip angle vs force and the like, you will use the tire forces to determine the rotation of the vehicle. Right now I'm just using a coefficient for the cornering stiffness multiplied with the slip angle to calculate the lateral force. Planning on an implementation of Pacejka Magic Formula if anyone could tell me how to use it with respect to the speed. Quote:Original post by CombatWombat Now you can integrate the cars rotation just as you would its linear behavior. AngularAcceleration = netTorque/Inertia AngularVelocity += AngularAcceleration Angle += AngularVelocity I've tried to calculate the rotation that way but it gives too slippy results at higher speeds since the car receives the same angular acceleration, no matter the speed. Should the inertia increase with the speed or how can I make it more realistic?
  8. I'd like to calculate the angular acceleration of a car from a given lateral force. So my problem is that I need a formula like a(F), instead of a = v^2 / r. The only solution I could come up with is by calculating the radius of the car's turn and then directly calculate the angular velocity: a = v^2 / r r = v^2 / a r = v^2 / (F * m) omega = v / r (angular velocity) This way the angular velocity is calculated with respect to the speed (which was what I wanted), but the problem is that it dosen't care about the inertia and wheelbase. So how am I supposed to calculate the angular acceleration correctly with respect to the velocity?
  9. peter86

    Cornering force and speed

    I read Brian Beckman's article about the Pacejka Magic Formula for lateral forces, see http://phors.locost7.info/phors22.htm. Seems the formula gives the maximum possible conering force at a given slip angle, but how is this related to the speed? As he states in the last part "the forces generated at high speeds must be greater than the forces at low speed with the same slip angles". If I just apply the force given by the formula without any adjustment at small speeds, the car will apparently start moving sideways instead of turning. So how do I calculate the cornering force with respect to the speed? The only way I can think of is to check the steer angle and calculate how much sideways force the car could take without slipping, but that would spoil the whole formula and I want a model that allows for slipping.
  10. Quote:Original post by SiCrane You can use iterators to go through the list and then use erase() instead. Okey, I'll try that. Thanks a lot!
  11. Quote:Original post by SiCrane If you want to use list::remove() you'll need to have a comparison operator for your user defined type. If you don't use remove() for the user defined type then list won't require your class to define equality. How else could I possibly remove an element from the list? Is there any way?
  12. I tried to use a STL list with a struct but the compiler comes up with a lot of errors. Do I have to make an operator == for each type I'm gonna use or how do I get the compiler not to complain? See example app and build log below. #include <list> using namespace std; struct MyStruct { int i; }; void main() { list<MyStruct> lst; MyStruct data; data.i = 10; lst.push_back( data ); lst.remove( data ); } ------ Build started: Project: test, Configuration: Debug Win32 ------ Compiling... main.cpp c:\Program\Microsoft Visual Studio .NET 2003\Vc7\include\list(682) : error C2784: 'bool std::operator ==(const std::list<_Ty,_Alloc> &,const std::list<_Ty,_Alloc> &)' : could not deduce template argument for 'const std::list<_Ty,_Ax> &' from 'std::allocator<_Ty>::value_type' with [ _Ty=MyStruct ] c:\Program\Microsoft Visual Studio .NET 2003\Vc7\include\list(976) : see declaration of 'std::operator`=='' c:\Program\Microsoft Visual Studio .NET 2003\Vc7\include\list(679) : while compiling class-template member function 'void std::list<_Ty>::remove(const _Ty &)' with [ _Ty=MyStruct ] c:\documents and settings\administratör\skrivbord\test\main.cpp(12) : see reference to class template instantiation 'std::list<_Ty>' being compiled with [ _Ty=MyStruct ] c:\Program\Microsoft Visual Studio .NET 2003\Vc7\include\list(682) : error C2784: 'bool std::operator ==(const std::allocator<_Ty> &,const std::allocator<_Other> &)' : could not deduce template argument for 'const std::allocator<_Ty> &' from 'std::allocator<_Ty>::value_type' with [ _Ty=MyStruct ] c:\Program\Microsoft Visual Studio .NET 2003\Vc7\include\xmemory(165) : see declaration of 'std::operator`=='' c:\Program\Microsoft Visual Studio .NET 2003\Vc7\include\list(682) : error C2784: 'bool std::operator ==(const std::istream_iterator<_Ty,_Elem,_Traits,_Diff> &,const std::istream_iterator<_Ty,_Elem,_Traits,_Diff> &)' : could not deduce template argument for 'const std::istream_iterator<_Ty,_Elem,_Traits,_Diff> &' from 'std::allocator<_Ty>::value_type' with [ _Ty=MyStruct ] c:\Program\Microsoft Visual Studio .NET 2003\Vc7\include\iterator(223) : see declaration of 'std::operator`=='' c:\Program\Microsoft Visual Studio .NET 2003\Vc7\include\list(682) : error C2784: 'bool std::operator ==(const std::istreambuf_iterator<_Elem,_Traits> &,const std::istreambuf_iterator<_Elem,_Traits> &)' : could not deduce template argument for 'const std::istreambuf_iterator<_Elem,_Traits> &' from 'std::allocator<_Ty>::value_type' with [ _Ty=MyStruct ] c:\Program\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(940) : see declaration of 'std::operator`=='' c:\Program\Microsoft Visual Studio .NET 2003\Vc7\include\list(682) : error C2784: 'bool std::operator ==(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'std::allocator<_Ty>::value_type' with [ _Ty=MyStruct ] c:\Program\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(641) : see declaration of 'std::operator`=='' c:\Program\Microsoft Visual Studio .NET 2003\Vc7\include\list(682) : error C2784: 'bool std::operator ==(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'std::allocator<_Ty>::value_type' with [ _Ty=MyStruct ] c:\Program\Microsoft Visual Studio .NET 2003\Vc7\include\utility(57) : see declaration of 'std::operator`=='' c:\Program\Microsoft Visual Studio .NET 2003\Vc7\include\list(682) : error C2676: binary '==' : 'std::allocator<_Ty>::value_type' does not define this operator or a conversion to a type acceptable to the predefined operator with [ _Ty=MyStruct ] Build log was saved at "file://c:\Documents and Settings\Administratör\Skrivbord\test\Debug\BuildLog.htm" test - 7 error(s), 0 warning(s) ---------------------- Done ---------------------- Thanks in advice, Peter
  13. Why do I get 3 bytes into the file when I explicitly wrote 2? And why does this only appear if i give num a value of 10? See code below. File data is: '0d 0a 00'. Shouldn't it be: '0a 00'? // C++ version ofstream file; file.open( "file001", ios::out ); unsigned short num = 10; file.write( (char*)&num, 2 ); file.close(); // C version FILE *pFile; pFile = fopen( "file001", "w" ); unsigned short num = 10; fwrite( (void*)&num, 2, 1, pFile ); fclose( pFile );
  14. I came across a confusing phenomenon; why is sizeof(myStruct) == 8? struct myStruct { unsigned long numberOne; unsigned short numberTwo; }; If I put the pragmas below around it, the size will be 6, why? When do I need to use this "workaround"? And what does this pragma do? #pragma pack(push, 1) /* ... */ #pragma pack( pop )
  15. I'm just wondering what reserved parameters are used for. They come up in a lot of functions, but since you cannot use them, they don't seem to do any good to me. So I'd like an explanation of what they are used for and why.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!