HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Flying height increases near cliffs

07-20-2007, 02:32 AM#1
Strilanc
I am making a racing game with realistic physics, which of course requires allowing cars to fly through the air. The problem is that flying units will raise their height as they approach a cliff (presumably so they don't appear to jump up once there). This is incredibly frustrating because... well cars don't just start floating when you go near a wall.

So far I've "fixed" this by using ground units. This works, but it makes driving off a cliff look bad (because ground units can't be directly on the cliff, they skip around it).

Is there any elegant way around this?
07-20-2007, 03:53 AM#2
grim001
Stop using setunitposition, use setunitx and setunity...

But you should really just wait for my physics engine...
07-20-2007, 10:23 AM#3
Strilanc
Quote:
Originally Posted by grim001
Stop using setunitposition, use setunitx and setunity...

But you should really just wait for my physics engine...

You don't seriously expect me to give you the funnest part?! Are you just talking about simple particle physics, or does it cover movement by wheels (where the force comes from traction on the ground)? The physics of my game is getting quite good, because I've started filling in true-to-life physical values instead of whatever works and get decent behavior.

In any case, your suggestion worked after I remembered to set the elevation sample radius back to 0. The car doesn't lift of its own free will anymore. However, I do still have a problem: the car tilts based on nearby terrain and when it turns (using SetUnitFacing).

Now, I don't necessarily want to eliminate the tilt; tilting based on the terrain directly underneath looks a lot better than no tilt at all; but if I had more control over it that would be great.

Essentially: Can I set the tilt (on both axis)? If not, can I ensure it is only affect by the slope of terrain DIRECTLY underneath? I would like to keep Art - Maximum Pitch/Roll to 90.
07-20-2007, 10:46 AM#4
grim001
Quote:
Originally Posted by Strilanc
does it cover movement by wheels (where the force comes from traction on the ground)?
This isn't what you need for wc3.

Quote:
Originally Posted by Strilanc
Can I set the tilt (on both axis)?
No.

Quote:
Originally Posted by Strilanc
If not, can I ensure it is only affect by the slope of terrain DIRECTLY underneath?
No.

Quote:
Originally Posted by Strilanc
I would like to keep Art - Maximum Pitch/Roll to 90.
Why?
07-20-2007, 11:58 AM#5
Strilanc
I wanted to keep the roll/pitch at 90 because I like the car being correctly tilted when on a cliff face. I'll have to compromise at set it lower to find the best trade off.

I think you misunderstood my comment about traction. I need to calculate how the car will slide/accelerate based on the power being sent to the wheels and the current speed of the wheels relative to the ground. For example, a car will slide further sideways if you are spinning your wheels.

Thanks for your help.
07-20-2007, 12:36 PM#6
grim001
Quote:
Originally Posted by Strilanc
I think you misunderstood my comment about traction.
I think you misunderstand what it is you actually want. "Wheels" and "traction" and all that are very specific concepts that have no use here. You're not doing a high-level physics simulation that actually includes objects such as wheels. You're doing a vague approximation that only needs to look that way from very far away. Maybe if you think a bit about what you're actually trying to accomplish it'll clarify what you need to do.
07-20-2007, 01:03 PM#7
Anitarf
It is possible to get full tilt control. What you need is a model with a head or chest bone at it's origin (so you can use SetUnitLookAt() to change it's facing angle and angle of attack) and a 360 (or less, depending on the accuracy you want to have) stand animations covering all possible roll angles. Then, you just need to do some craaazy vector math and voila, you have a laggy car or airplane that can however face anyway you like.
07-20-2007, 07:21 PM#8
Strilanc
Quote:
Originally Posted by grim001
I think you misunderstand what it is you actually want. "Wheels" and "traction" and all that are very specific concepts that have no use here. You're not doing a high-level physics simulation that actually includes objects such as wheels. You're doing a vague approximation that only needs to look that way from very far away. Maybe if you think a bit about what you're actually trying to accomplish it'll clarify what you need to do.

I understand that, and I understand what it is I want to do. You can model a car and how the wheels power the car, but all you've really modeled is a rocket on wheels. Real cars behave very differently (for example: they can't accelerate well on ice, a rocket with wheels can).

I'm definitely not including wheels in the sense you meant in your post. I do include "wheels" in that I can compute how quickly the wheels are spinning versus how much they are sliding.

For example, here is my current "rocket on wheels" traction:
Collapse JASS:
//... code ...
if (r.isBraking) then
  //All-Around Ground Friction
  set acceleration = r.velocity.clone()
  set v = r.velocity.getLength()
else
  //Side-to-Side Ground Friction
  set acceleration = r.velocity.projection(dirSide)
  set v = r.velocity.scalarProjection(dirSide)
endif
set a = normalForceMagnitude*r.traction*getTractionAt(tx, ty))/r.mass
call acceleration.setLength(-a)
//... code ...
07-20-2007, 10:17 PM#9
grim001
Quote:
Originally Posted by Anitarf
so you can use SetUnitLookAt()
I heard it's not instant...

I guess I'd have to see more than that to know what you're doing Strilanc, but I think you'd be interested in testing my physics engine. Do you have AIM, MSN, etc.?
07-21-2007, 03:01 AM#10
Strilanc
Quote:
Originally Posted by Anitarf
It is possible to get full tilt control. What you need is a model with a head or chest bone at it's origin (so you can use SetUnitLookAt() to change it's facing angle and angle of attack) and a 360 (or less, depending on the accuracy you want to have) stand animations covering all possible roll angles. Then, you just need to do some craaazy vector math and voila, you have a laggy car or airplane that can however face anyway you like.

How does SetUnitLookAt() even work? I tried making a paladin's head face a footman, but nothing happened.
07-21-2007, 10:43 AM#11
blu_da_noob
Quote:
Originally Posted by grim001
I heard it's not instant...

It's limited by the unit's animation blend time, so if that's 0 then it is instant.
07-21-2007, 01:04 PM#12
grim001
OK, someone make this amazing model and I'll put it to good use.
07-21-2007, 01:28 PM#13
Rising_Dusk
You know, every topic grim posts in seems to gradually suck more as it progresses.
"Wait for my system..." I've heard that in nearly every topic you contribute to for the past like, 2 months.

And Ani, isn't that model sort of close to the pitch dummy you've made already?
And if so, couldn't you modify yours to match those requirements?
07-21-2007, 02:38 PM#14
grim001
1.) I only post that where it's applicable.
2.) There's a big difference between hearing it 2 months ago then hearing it again now, compared to hearing it for 2 months straight.
3.) I didn't know you were a moron.
07-21-2007, 08:48 PM#15
Strilanc
Grim I'll pm you my info.

Anitarf I made a simple model with only one bone, but I couldn't make it turn using the face call.

Rising_Dusk don't hijack the thread.