Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / uneven landing (read to understand :P)

Author
Message
adr
23
Years of Service
User Offline
Joined: 21st May 2003
Location: Job Centre
Posted: 25th Jun 2003 01:01
I've been trying to think of a solution to this problem for some time now, but I can't seem to get started.

Imagine you have a helicopter:

Now, imagine that it can land on an uneven surface. It's fairly easy to make the helicopter track the terrain (as if it were a car), but that isn't what's happening. Block A could hit the ground first, then it could be followed by B, then D, then C - uneven landing.

I'm not really expecting code (not unless you want to ) but just ideas on how to go about the gradual rotation affair...
adr
23
Years of Service
User Offline
Joined: 21st May 2003
Location: Job Centre
Posted: 25th Jun 2003 01:39
I'm also beginning to think that I could use box collision if I weren't using a matrix :/
BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 25th Jun 2003 01:39
I guess the starting point is to add a point! Surely you need a pivot point, and you calculate A,B,C and D relative to this. The extra point would be somewhere near the middle.

Thanks in advance.
All the Best,
StevieVee
adr
23
Years of Service
User Offline
Joined: 21st May 2003
Location: Job Centre
Posted: 25th Jun 2003 02:04
Well, turn/pitch/roll would rotate it around its centre, which would make it float around. So, yes, I need a pivot point, but as far as I'm aware you can't dynamically change the pivot point.

Surprisingly, I'm still stuck on the "don't allow the model to go any lower" code...

(I'm going to revert to matrices for the moment, since using a .x file broke everything)
Ian T
23
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Around
Posted: 25th Jun 2003 02:11
I may be wrong, but can't you:

-Find whichever point is lower
-See if it is colliding with the ground
-If it under the ground, rotate the object away from that point until it isn't

?

--Mouse

Famous Fighting Furball
adr
23
Years of Service
User Offline
Joined: 21st May 2003
Location: Job Centre
Posted: 25th Jun 2003 03:02
that sounds kinda like a hard coded approach. You know, once you're feet hit the ground, the code will take over an pull you to the ground, which isn't what I'm looking for - more of a realistic landing...
iaretony
23
Years of Service
User Offline
Joined: 6th Jun 2003
Location:
Posted: 25th Jun 2003 04:20
Hmmm... This is an interesting problem, and I'm figuring this out as I go, so I could be wrong here, but in general I think you need to maintain 3 angular velocity variables. These will contain the current rotation speed for each of the 3 dimensions. Now, having said that, I think that in landing, you will only need to tweek two of them.

Also, I think that for each of these variables, a positive value means rotation one way, and a negative value means rotation the other.

In you're image, A is going to hit the ground first. Common sense tells me that after A hits, the object will begin rotating TOWARDS B and also towards D.

So, you need to ADD a scalar to the angular velocity variable that controls A->B rotation, and add a scalar to the angular velocity variable that controls A->D rotation.

How do you get the value of these scalars? Hmm, well, once again common sense tells me that it depends how far A, B, C, & D are from the center of mass of the object, but only in one dimension. I don't think I can explain in words what I'm talking about here... But the above should be enough to get you started....

Also, when the helicoptor hits the ground, their should be some sort of rebound, so you should add some UPWARD vector to the direction vector of the coptor... This will make the coptor bounce a little, and will look cool with the above rotations....

Tony

Muddleglum
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: New Zealand
Posted: 25th Jun 2003 07:08 Edited at: 25th Jun 2003 08:50
sorry ... edited out comment and gone away to think some more ...
but the simple method suggested by mouse can work quite well .
just 'anti-roll' or 'anti- pitch' in proportion to the current angle.
eg.
roll object rollangl# * .1 .. or suchlike amount.

the amount can be modified according to rate of descent to account for inertia and hence speed of attitude change on impact.

be interesting to see the jiggling effect produced by a number of contact points as on the heli picture above.

cheers.
adr
23
Years of Service
User Offline
Joined: 21st May 2003
Location: Job Centre
Posted: 25th Jun 2003 12:11 Edited at: 25th Jun 2003 12:11
iaretony's approach almost makes sense to me, since I am using pitch/roll variables to angle the helicopter. I know there's a relationship between the downward thrust (for which I have a variable), A's contact on the floor (which I can determine), the current angles (for which I have variables) and the required roll/pitch change, but I just can't quite piece it all together.

The only theoretical problem now is pivoting the heli around whichever point was the last to hit the ground; Roll/Pitch commands will rotate the object around it's centre...

I'll have another look tonight. As someone pointed out, this is an intereting problem..... Any source code donations are welcome
Beta1
23
Years of Service
User Offline
Joined: 28th Dec 2002
Location:
Posted: 25th Jun 2003 16:50
Surely its a torque effect. Dreding the depth of my brain for A level physics...

When the helicopter hits the ground at A theres going to be a force acting upwards at A equivelent to mass of the machine * gravity (not quite sure about that) That will result in a torque (rotational force) equal to the distance from the impact point to the centre of mass, you can use that to calculate the change in rotation speed. The rotation should then mean that as the object continues to fall it rotates so A remains in contact with the ground.

Of course that may all be rubbish.

Glennyboy
23
Years of Service
User Offline
Joined: 26th Feb 2003
Location: United Kingdom
Posted: 25th Jun 2003 17:02 Edited at: 25th Jun 2003 17:11
This is a totally gay solution so feel free to ignore it...

However.

Many helicopter sims I've played cheat. If part of the undercarriage is under the ground, they check the angle of the chopper. If it's mostly level, then just straighten it and flick it onto the ground. If it's quite tilted, then the copter takes damage. This force the player to keep the helicoptor level when they go in for a landing, and so the "flicking" isn't all that much of a jolt for a successful landing.

adr
23
Years of Service
User Offline
Joined: 21st May 2003
Location: Job Centre
Posted: 25th Jun 2003 18:07
D'you know... I might just try that until I can figure out the "best" solution. It's slowing me down too much and I want to get other cool stuff done.

Is it just me, or is this the first helicopter game in db?

Please, if you feel inspired on how to solve this problem, I'm all ears.
The Darthster
23
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 25th Jun 2003 19:04
Beta 1 I think you're right, except the force to provide the rotation wouldn't just be the weight, it would be the weight minus the upwards force provided by the rotors.

One of the best things to learn in game development is how to cheat, and cut corners. If you can sucessfully use wrong or simplified physics without the players noticing too much, then there isn't anything to worry about. As long as it looks right, as far as the player is concerned it is right.

Once I was but the learner,
now, I am the Master.
Beta1
23
Years of Service
User Offline
Joined: 28th Dec 2002
Location:
Posted: 25th Jun 2003 19:30
I thought it didnt sound quite right with just the mass.

I guess you need to put gravity in too. It all depends if he's doing proper accleration/velocity/position type maths or just directly changing the velocity rather than applying forces.

I tried some "real" physics a few months back but couldnt get it working well in 3D, in 2D it worked nicely, even with elastic/inelastic collisions, it just went screwy in 3D.

I will probably go back to it at somepoint.

iaretony
23
Years of Service
User Offline
Joined: 6th Jun 2003
Location:
Posted: 25th Jun 2003 19:50
I think it's fine to rotate about you're center of gravity... In fact, I think that is more accurate... Remember, contact with the ground will cause A to bounce. UP...

I should write a demo or something...

Tony

adr
23
Years of Service
User Offline
Joined: 21st May 2003
Location: Job Centre
Posted: 25th Jun 2003 20:08
If I rotate around the centre of gravity, then I'll need to move the object continously, surely?

And if you're inclined to write a demo, be my guest I really do plan to make this a full game, by the way. Probably not commerical, but I'll make sure it's as close to commerical quality as possible. Depending on quality, it could be a *giant* tutorial when finished.

You'll notice that I haven't bombarded the forums with requests for modellers, because I'm still not sure if this is all possible. I'll only get models/textures done properly when I need them...

(Still at work, so I can't do any db yet)
Muddleglum
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: New Zealand
Posted: 26th Jun 2003 02:01
you say 'If I rotate around the centre of gravity, then I'll need to move the object continously, surely?'

not necessarily for a simplified method, since the main reactions occur around the c.g.

the landing skid will er... skid to a degree, rather than push the whole mass of the craft away.
I did use a displacement vertically of the flying object with an aircraft landing, but this was mainly so the wheels would visibly remain in contact with the ground. My own helicopter just does a slowed down 'levelling out' as said earlier.


Possibly also a helicopter will, like a plane, bounce back up at an slight angle when there is strong foward motion ... since the rotor on a fast moving heli is rather like a plane's wing and the lift is quite close to 'lift off' amount when it impacts.
Easy to add this anyway. mmm might try it straight away.

cheers.
adr
23
Years of Service
User Offline
Joined: 21st May 2003
Location: Job Centre
Posted: 26th Jun 2003 02:25 Edited at: 26th Jun 2003 02:40
One of the best things to learn in game development is how to cheat, and cut corners...As long as it looks right, as far as the player is concerned it is right.

Well, I've done that very well with the flight model itself *pats himself on the back*. Totally fudged the flight physics and they feel great to me - wouldn't change a thing. I didn't do A-Level Physics though (just maths) so Beta 1, (or anyone) if you could explain a little further, I might be able to code it up.

-------------------------

Just had an epiphany (sp)... for some reason I was thinking that rotating around the centre of gravity would look wrong, but it wouldn't necessarily... infact, the "bounce" that iaretony is talking about would be in relation to the downward force being exherted... so the smaller the force, the smaller the bounce. Becoming so small that it'll just land. But dammit - it's almost midnight and I've got work tomorrow!
iaretony
23
Years of Service
User Offline
Joined: 6th Jun 2003
Location:
Posted: 26th Jun 2003 03:17
Exactly!

Eventually, the bounce will settle. I think this is one of those cases where it will just work out and look right because in reality it just works out and looks right...

I think all you need to do is when the rotation amount you're adding reaches a small enough value, stop adding it, you're done.

Tony

iaretony
23
Years of Service
User Offline
Joined: 6th Jun 2003
Location:
Posted: 26th Jun 2003 03:18
I want to play it!

My email addrss is [email protected]

Tony

Willy
23
Years of Service
User Offline
Joined: 17th Jun 2003
Location: Ohio
Posted: 26th Jun 2003 07:43
Similar problem to a car. If you know the object's center axis, and you know how big the thing is, you can find the four X,Z corners of the skids. (Just like where the four wheels are, for a land vehicle.) You can do a 'get matrix height' at each of the four corners, to find out what is going to hit first. (Subtract each matrix height from the corresponding skid corner height.)

You can either bounce, or rotate the object to bring the rest of that skid, and the other skid, to the ground. That would depend on how hard it hit the ground (Y velocity).
Think of it as a box, and do some terrain following with your box. You need to be able to PITCH and ROLL as the ground pitches and rolls.
Same problem as a car. (You might want to land on the side of a hill...)

If you want to be really realistic, don't forget to include "ground effect", which gives the rotors more lift as you get closer to the ground...

Willy
adr
23
Years of Service
User Offline
Joined: 21st May 2003
Location: Job Centre
Posted: 26th Jun 2003 12:57
Quote: "If you want to be really realistic, don't forget to include "ground effect", which gives the rotors more lift as you get closer to the ground..."


Argh! forgot about that... oh well - I'm happy with the flight physics now so I don't think I'll be changing them unless I have too.

Quote: "I want to play it!"

Once I've got this landing problem sorted, I'll release a little demo. At the moment, flying through the floor has a bad effect on the game's coolness.
adr
23
Years of Service
User Offline
Joined: 21st May 2003
Location: Job Centre
Posted: 29th Jun 2003 02:22
hooray. I haven't really done what I set out to do originally, but I guess for the moment I'll have to settle for less. There are still a few tiny little bugs here and there, but I should have some time tomorrow to get rid of them. When I'm happy with the landing routines, I'll post a demo.

Until then, have some screenies...
http://www.fuzzee.co.uk/game/shot7.jpg
http://www.fuzzee.co.uk/game/shot9.jpg

Login to post a reply

Server time is: 2026-07-17 23:54:26
Your offset time is: 2026-07-17 23:54:26