Archived

This topic is now archived and is closed to further replies.

SoaringTortoise

Thrust + Velocity not sufficient

Recommended Posts

Hi, I''m using standard newtonian physics to model a ball on an undulating surface. At present I am using impact reflection, gravity, friction, thrust and velocity. But these aren''t sufficient for modelling what I am doing. For example, I want the ball to have a maximum speed on a flat plane which I limit by introducing air-resistance which eventually cancells out the thrust after a certain speed. The problem is that the maximum thrust required to achieve that top speed is not enough to overcome mild inclined planes. I can increase the air-resistance so that more thrust is required to achieve the same speed, and so that the maximum thrust is enough to climb inclined planes, but then free-fall movement seems unnatural. So... how do I limit the maximum speed of the object, while still allowing it to have the ability to climb steep inclines? Imagine something like a landrover, which can climb 60-degree slopes, but has a very low top speed compared to a sports car which has completely opposite behaviour (fast on flats, no climbing ability). I can just clamp the top speed, but I''m trying to make this thing as realistic as possible. Learning to fly is easy, but as a tortoise, the landings are really rough.

Share this post


Link to post
Share on other sites
I would increase the mass of the ball. Are you making the "air resistance" basically by new_vel = old_vel * 0.97? if so, then ball mass won''t affect how fast the velocity decay occurs. Ball mass never affects its own gravitational acceleration, so that will be OK as well. then just give the ball more thrust force for the same amount of acceleration.

you may want to give the ball a "Star Control"-ish acceleration function instead (it basically finds out what the result velocity is and limits the acceleration to prevent the velocity one second in the future from being greater than a max speed. It''s a pretty "comfortable" was to clamp velocity)

Share this post


Link to post
Share on other sites
Hmmm.. I like the first method. The second method is a cheat, and I really want to avoid that type of thing because I tried it that way with all of the physics and just ended up getting tied up in knots as the environment parameters changed.

Will change the mass and get back to you if it doesn''t work as expected. Thanks.

Learning to fly is easy, but as a tortoise, the landings are really rough.

Share this post


Link to post
Share on other sites
Take your previous speed and multiply it by your coefficient of air-friction, then subtract the result from the new speed. Or variations thereof depending on thought process and preference.

Please stick to the thread though... I don''t want to lose my issue in a sub-thread.

Learning to fly is easy, but as a tortoise, the landings are really rough.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
More realistically air resistance would be made proportional to the square of the velocity. That might give you the desired behavior.

Share this post


Link to post
Share on other sites
Yah, if you want to be accurate then you do that (square the velocity). Comes in handy with the terminal velocity issue. Still, any thoughts on my problem? I think I need to go into Power functions, but not too sure how deeply.

Learning to fly is easy, but as a tortoise, the landings are really rough.

Share this post


Link to post
Share on other sites
Well, thrust is the impulse that you assign to the object, which is basically an acceleration vector. Acceleration is the total of gravity and thrust and a couple of other acceleration-type vectors. Force is mass*acceleration, but since I''m using unit mass, this is basically just acceleration.

Learning to fly is easy, but as a tortoise, the landings are really rough.

Share this post


Link to post
Share on other sites
One thing you might want to think about (if you haven't already) is which direction you are applying the force, or thrust, on the ball when going up a hill. If the thrust is always parallel to the flat plane (usu. xz-plane), then going up a hill will put the thrust/force into the hill, resulting in only a little bit of forcing actually pushing the ball up the hill. If thats the case, you need to make sure your force is applied parallel to the hill, so that the full magnitude of the force is going up the hill.

Another thing is regarding the Landrover/sports car thing you were talking about. The difference (I think) is that sports cars have engines that go up to really high RPMs, and have huge gear ratios on their transmissions, enabling them to go fast at a sacrifice of the low-end acceleration. Meanwhile a Landrover has a ton of torque, and low gears. Think of a bike. If you tried to go fast in first gear, you could get to your top speed of 3 mph real quick. But if you stayed in the highest gear, pedaling would be really hard and slow at first, but you could eventually go a lot faster.

Conclusion: Install a transmission in your ball.

Hope all that made sense.

[edited by - granite811 on March 5, 2003 2:06:35 PM]

[edited by - granite811 on March 5, 2003 2:07:20 PM]

Share this post


Link to post
Share on other sites
Install a transmission! Do you have any idea what the polycount is on that!

But seriously, how? What''s the formulas?

Learning to fly is easy, but as a tortoise, the landings are really rough.

Share this post


Link to post
Share on other sites
To get the formulas for air resistance (and a free flame war) check the topic "terminal velocity" a couple of topics further down

I don't have the energy to write it all again.
And I definately don't have the energy to debate with BrinnandeKomet again


Hope it's useful to you!

Ulf

Edit: Here's a link to the topic:

http://www.gamedev.net/community/forums/topic.asp?topic_id=141112

[edited by - UlfLivoff on March 6, 2003 10:08:19 AM]

Share this post


Link to post
Share on other sites
Yeah, but air-resistance isn''t the problem, it''s how to model torque (i think). A vehicle can apply lots of power to a problem, but that power doesn''t correspond to speed.

Learning to fly is easy, but as a tortoise, the landings are really rough.

Share this post


Link to post
Share on other sites
Hmmm.. I'm not sure I know what you mean - but air resistance is the only reason (ok ok not *only* but let's keep it simple) that a car has a top speed. If you had a highway on the moon, the car would just keep accelerating (i think - i have thought about this for about 5 sec now)

anyone disagrees on that one ??

Ulf

OK - nevermind next time I will read all the posts before I start posting myself ...

[edited by - UlfLivoff on March 6, 2003 10:34:44 AM]

Share this post


Link to post
Share on other sites
At some point, the explosions in the car''s engine won''t be able to produce any pressure because the piston is already moving as fast as the explosion could expand, and produce a suction instead, slowing you down.

It''s called "compression braking" I think...

Anyway, the only good docs I''ve seen on Torque say "take the cross product of the force direction vector and the vector from the center of mass to the point at which the force is applied"... that gives you a vector in the direction of the axis of rotation, either positive or negative on that axis depends on whether it is a clockwise or counterclockwise rotation...

Other than that, I can''t help you. Stupid rotation inertia stuff is pretty lame...

Share this post


Link to post
Share on other sites
OK, but is Torque what I need to use to model this? Or do I need to start working on Power formulas? If I remember correctly

Power = Force/Time

So... a tractor uses great force over a long time, but a race car uses the same force over a short time. But.... how do I translate this all into movement capabilities? As far as I know, at any given point in time (i.e. every frame) the only thing that causes movement is a Force (mass*acceleration), so presumably I should be specifying a Power value and multiplying it by the rate at which the power can be applied to get the actual force every frame. But how can I model this in a frame-based interative model?

Would I say, ''Every Second, this engine generates X power. Interpolate the current time from the last second to get how much power must be used this frame. Get the acceleration from the power.''?????

But that still wouldn''t work. If a tractor can expend 20N every second, but a race car can produce 40N, it would model the top-speed on a flat surface reasonably well, but it wouldn''t make any difference to the hill-climbing behaviour.



Learning to fly is easy, but as a tortoise, the landings are really rough.

Share this post


Link to post
Share on other sites
Power shouldn''t matter -- Your ball has a constant acceleration, gravity is constant acceleration.

Here''s what should happen:

At any given angle, the projection of the gravity vector will be what accelerates your ball downhill. Add that to your player-generated acceleration. Factor in the wind resistance and surface friction, and you won''t be able to go faster than a certain speed, which is affected by all of those variables.

Share this post


Link to post
Share on other sites
Yah, I get that, but the problem is:

1) I want a slow top-speed on flat ground. If I increase air-friction, then the ball''s trajectory as a projectile looks weird.
2) I want good climbing ability (slopes up to about 60-degrees). To be able to do this, I need to increase the acceleration(thrust) to overcome the slope. If the thrust is high then the ball can achieve high speeds.

Circular problem. I increase air-resistance to cap the max speed, but it messes with projectile behaviour. I increase thrust to overcome slope, and it messes with max speed.

I am becoming happier with the idea of just saying, "Maximum Speed Under Power = x" and clamping it to that. It just seems like a cheat, but it would work because I can increase the acceleration to climb hills, I can leave the air-friction alone and I can get the correct maximum speed that I want.

Learning to fly is easy, but as a tortoise, the landings are really rough.

Share this post


Link to post
Share on other sites
Ya I don''t see an elegant way around making it a hack. Just make sure the hack doesn''t kick in if they try to apply thrust in mid air.

Share this post


Link to post
Share on other sites