![]() ![]() |
Oct 10 2009, 04:12 PM
Post
#1
|
|
|
Advanced Member ![]() ![]() ![]() Group: Members Posts: 21 Joined: 6-September 09 Member No.: 9,271 |
Can someone throw me in the right direction on how to implement drifting?
Also, maybe I am not understanding everything but whats the purpose of having a "wheel" and a "wheelshape"? It seems to be redundant when they go through a wheeldesc set values then go through a wheelshapdesc and basically just send everything from wheeldesc to it. |
|
|
|
Oct 19 2009, 07:27 AM
Post
#2
|
|
|
Advanced Member ![]() ![]() ![]() Group: Moderators Posts: 383 Joined: 17-April 08 Member No.: 5,015 |
Can someone throw me in the right direction on how to implement drifting? Also, maybe I am not understanding everything but whats the purpose of having a "wheel" and a "wheelshape"? It seems to be redundant when they go through a wheeldesc set values then go through a wheelshapdesc and basically just send everything from wheeldesc to it. I guess the "wheel" is the "NxWheel" in sample, right? It's just a wrapper of wheel shapes. |
|
|
|
Oct 24 2009, 11:00 AM
Post
#3
|
|
|
Advanced Member ![]() ![]() ![]() Group: Members Posts: 46 Joined: 21-September 08 Member No.: 6,347 |
Implementing drifting the right way requires sophisticated modeling of suspension and tires, something PhysX wasn't really made for as a general purpose library. Even hard-core racing sims have issues with drifting.
So, how simplified can it be to suit your needs? There are some threads on modeling cars (especially wheels), search the forum. |
|
|
|
Oct 31 2009, 04:26 AM
Post
#4
|
|
|
Advanced Member ![]() ![]() ![]() Group: Members Posts: 21 Joined: 6-September 09 Member No.: 9,271 |
Implementing drifting the right way requires sophisticated modeling of suspension and tires, something PhysX wasn't really made for as a general purpose library. Even hard-core racing sims have issues with drifting. So, how simplified can it be to suit your needs? There are some threads on modeling cars (especially wheels), search the forum. I actually want it to be very simplified, I'm not trying to model real world behavior. Altering the stiffnessFactor for the wheelshapes produces some kind of drift but what I really want is to have the back end of the vehicle slide out when wheel torque is applied. |
|
|
|
Oct 31 2009, 04:08 PM
Post
#5
|
|
|
Advanced Member ![]() ![]() ![]() Group: Members Posts: 189 Joined: 28-August 08 Member No.: 6,169 |
you have to play with the hermite curves on the wheel friction to find what best suits you
|
|
|
|
Nov 1 2009, 12:54 AM
Post
#6
|
|
|
Advanced Member ![]() ![]() ![]() Group: Members Posts: 21 Joined: 6-September 09 Member No.: 9,271 |
you have to play with the hermite curves on the wheel friction to find what best suits you Do you happen to know off the top of your head what are good values to induce slip laterally for the lateralTireForceFunction? I would like to induce extreme lateral slip with very little motor torque applied. Thanks for the help. |
|
|
|
Nov 1 2009, 07:26 PM
Post
#7
|
|
|
Advanced Member ![]() ![]() ![]() Group: Members Posts: 46 Joined: 21-September 08 Member No.: 6,347 |
If you want to destabilize the rear, there are a couple of things you could do. Starting with giving the tires low lateral grip and perhaps giving the wheels some toe-out angle (http://en.lfsmanual.net/wiki/Image:Setup06.jpg).
Remember to only do this for the rear wheels, you want the front wheels to be relatively grippy so the players can turn. This is a nasty thing to do (low grip on back, high grip on front) as it will induce massive oversteer but your backside should be getting pretty funky when the throttle is pushed. You'll want rear wheel drive for this particular effect, I advise to actually do AWD with a parameter to set drive balance between front and rear,as an all RWD setup with such tires can lead to an unwieldy car. See, when the car is in a turn and the driver pushes the accelerator, when the power goes to the rear, it will push the vehicle into the turn, possibly with a nice drift (if the parameters are just right) but there's risk the rear wheels will overtake the non-powered front wheels and you'll spin or come out of the turn riding backwards. When the drive is on front wheels, they will pull the car into whichever direction they are pointed, there's less opportunity for a spin and it's more obvious to the inexperienced driver where the car will go. A good balance between FWD and RWD is a must (note, it's possible that the optimal value will be max RWD or FWD). Also, longitudinal grip is a factor - it's easier to get the back dancing when the wheels are burning rubber. If you set the long. grip of the powered wheels too high, the car will simply shoot forward upon hitting the accelerator. On the other hand, if it's too low, the car will stand in place, powered wheels turning and burning, and there won't be any lateral movement either. If you can't come up with anything, you can just brutally add lateral torque on the chassis. Or altering center of weight so that it is in the front. Some of your players might notice the cheat though. |
|
|
|
Nov 2 2009, 12:26 AM
Post
#8
|
|
|
Advanced Member ![]() ![]() ![]() Group: Members Posts: 21 Joined: 6-September 09 Member No.: 9,271 |
If you want to destabilize the rear, there are a couple of things you could do. Starting with giving the tires low lateral grip and perhaps giving the wheels some toe-out angle (http://en.lfsmanual.net/wiki/Image:Setup06.jpg). Remember to only do this for the rear wheels, you want the front wheels to be relatively grippy so the players can turn. This is a nasty thing to do (low grip on back, high grip on front) as it will induce massive oversteer but your backside should be getting pretty funky when the throttle is pushed. You'll want rear wheel drive for this particular effect, I advise to actually do AWD with a parameter to set drive balance between front and rear,as an all RWD setup with such tires can lead to an unwieldy car. See, when the car is in a turn and the driver pushes the accelerator, when the power goes to the rear, it will push the vehicle into the turn, possibly with a nice drift (if the parameters are just right) but there's risk the rear wheels will overtake the non-powered front wheels and you'll spin or come out of the turn riding backwards. When the drive is on front wheels, they will pull the car into whichever direction they are pointed, there's less opportunity for a spin and it's more obvious to the inexperienced driver where the car will go. A good balance between FWD and RWD is a must (note, it's possible that the optimal value will be max RWD or FWD). Also, longitudinal grip is a factor - it's easier to get the back dancing when the wheels are burning rubber. If you set the long. grip of the powered wheels too high, the car will simply shoot forward upon hitting the accelerator. On the other hand, if it's too low, the car will stand in place, powered wheels turning and burning, and there won't be any lateral movement either. If you can't come up with anything, you can just brutally add lateral torque on the chassis. Or altering center of weight so that it is in the front. Some of your players might notice the cheat though. Thanks for the help. Yeah I guess its kind of a balancing act, I'm just going to have to play around with the values until I get something I like. I'm not really trying to be 100% real world accurate. |
|
|
|
Nov 7 2009, 03:09 AM
Post
#9
|
|
|
Advanced Member ![]() ![]() ![]() Group: Members Posts: 21 Joined: 6-September 09 Member No.: 9,271 |
Thanks for the help. Yeah I guess its kind of a balancing act, I'm just going to have to play around with the values until I get something I like. I'm not really trying to be 100% real world accurate. Hey I have a follow up question to this discussion. Lets say I'm getting the back end to slide out using the wheelshape in the Raycast car example, but the force is too great and I can't steer the front end back quick enough for my liking, (the back end overpowers the front) What would I have to do in order to have a more "controlable/managable" drift and make the front pull the car straight whenever I want? Thank you |
|
|
|
Nov 7 2009, 05:34 AM
Post
#10
|
|
|
Advanced Member ![]() ![]() ![]() Group: Members Posts: 189 Joined: 28-August 08 Member No.: 6,169 |
Think in terms of real cars. Cars are not easy to drift, but some are easier than others. Light, powerful, short wheelbase cars with high grip and low dynamic friction are almost impossible to control. But longer wheelbase, heavier cars with lower grip and a smaller difference between static and dynamic friction are a lot easier
What you are doing is not like the old game, but is a much more realistic physical simulation, so think about when you were 17 and used to "borrow" you parent's car when it snowed to drift it in in a parking lot. |
|
|
|
Nov 9 2009, 04:07 AM
Post
#11
|
|
|
Advanced Member ![]() ![]() ![]() Group: Members Posts: 21 Joined: 6-September 09 Member No.: 9,271 |
Think in terms of real cars. Cars are not easy to drift, but some are easier than others. Light, powerful, short wheelbase cars with high grip and low dynamic friction are almost impossible to control. But longer wheelbase, heavier cars with lower grip and a smaller difference between static and dynamic friction are a lot easier What you are doing is not like the old game, but is a much more realistic physical simulation, so think about when you were 17 and used to "borrow" you parent's car when it snowed to drift it in in a parking lot. Thanks for the help. I am almost getting the car to drift the way I want, I still have a lot of tweaking to do. One problem I'm running into is when the I turn the car and it drifts the car "straightens" itself out to quickly. I would like to keep the car more sideways until I actually turn it back. Is there anything I can do about that or is that the way the solver in PhysX does things and I can't control that? |
|
|
|
Nov 9 2009, 09:07 AM
Post
#12
|
|
|
Advanced Member ![]() ![]() ![]() Group: Members Posts: 189 Joined: 28-August 08 Member No.: 6,169 |
That's what cars do, and since you're simulating a real physics that's what I'd expect you to see. There are a couple of things you could do to control it though. Increasing car body weight is the easiest, but may not be the way you want to go. Alternatively, you could maybe detect drifting by comparing body direction of movement with the angle of the rear tyres and apply a per-simulation cycle force to the back of the car when it is snapping back. Not physically correct, but lit may help.
|
|
|
|
Nov 10 2009, 01:36 AM
Post
#13
|
|
|
Advanced Member ![]() ![]() ![]() Group: Members Posts: 21 Joined: 6-September 09 Member No.: 9,271 |
That's what cars do, and since you're simulating a real physics that's what I'd expect you to see. There are a couple of things you could do to control it though. Increasing car body weight is the easiest, but may not be the way you want to go. Alternatively, you could maybe detect drifting by comparing body direction of movement with the angle of the rear tyres and apply a per-simulation cycle force to the back of the car when it is snapping back. Not physically correct, but lit may help. Yes what you are talking about, applying the force is kind of what I was thinking about but I don't really know what to do. Would you consider taking a look at my project and helping me out? You could drive the car around I got now and then I could tell you what I'm looking for and it might make more sense. I could even give you a little something for your time. |
|
|
|
Nov 13 2009, 02:00 AM
Post
#14
|
|
|
Advanced Member ![]() ![]() ![]() Group: Members Posts: 21 Joined: 6-September 09 Member No.: 9,271 |
Can someone tell me how to get the angle of the vehicle? I'm looking throuh Vehicle.h. Does getDriveVelocity return the angle of the vehicle? Basically I want to find the angle of the vehicle and then when it reaches a certain angle then I want to perform certain actions on it. Such as apply a force to the rear wheels.
|
|
|
|
![]() ![]() |
|
Copyright © 2008 NVIDIA® Corporation. Terms of Use | Legal Info | Privacy Policy | Time is now: 23rd November 2009 - 11:36 PM |