Tank demo (using material callbacks)

Share with us how are you using the powerrrr of the force

Moderator: Alain

Postby Sascha Willems » Sat Jul 23, 2005 4:08 am

_Tux_ wrote:great work sascha. except ive noticed a side effect to using such high frictions. if you are going down hill and put the brakes on, the tank rolls onto the turret.

No, that's not really a side-effect of the high friction. The problem is that the center of mass for the chassis is "wrong". The chassis is a compound and as of now I just use the AABB of the whole compound to calculate the inertia for the chassis. And due to the fact that this tank has such a long gun, the gun "drags" the center of mass to the very front of the tank, which makes it easy to turn it over depending in which direction you move. When e.g. setting a very high acceleration and then driving backwards, the tank would go up in the air driving only on the front part of the wheels. But I'll change the center of mass so that it's really in where it belongs to and those things shouldn't happen anymore.

Stucuk wrote:When turning wouldn't it be best to have to have the forward or backward key down, so the tank would know to turn one track eather backwards or forwards when turning right or left, rather then backwards all the time?

Thanks, that's a great idea! Dunno why I haven't come to that conclusion. I'll definately implement this.
User avatar
Sascha Willems
Moderator
Moderator
 
Posts: 346
Joined: Fri Aug 27, 2004 10:18 am
Location: Germany

Postby Julio Jerez » Sat Jul 23, 2005 8:16 am

Jesus, is this a prove of concept?
In my contry we call that “un gallo en una funda” :D

About the control, what I do is that I have two functions
One for the forward acceleration and one for the steering acceleration
Say f in the forward acceleration
And s in the stirring acceleration

Then I apply to one side r = f + s
And to the other l = f – s

The good thing about this is that it does not add extra movement when turning, for example if you just stop one tread you are subtracting momentum and that is a discontinuity. In general discontinuities are a bad thing.
With this method the net acceleration changes continuously and there is not need to come up with complicated controls scheme.


edit:
I played some more and I think the canon bias the origin too much.

I assume that eventually it will be a linked part; if you get to do that then I think the origin should be biased, Now that I think of it, I always notice the American tanks like the MA1A have a very heavy turret that is skew to the opposite site of the cannon I assume that they had some counter way to avoid this effect.

Tell me something German tanks were unable to rotate the turret? The way I see this is one big monolithic body and the turret can only move up and down.

All in all this is extraordinary. I can imaging what the final would be.
Last edited by Julio Jerez on Sat Jul 23, 2005 5:30 pm, edited 3 times in total.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Postby The unProfessional » Sat Jul 23, 2005 3:06 pm

I tried something like this with newton a long time ago but didn't have much luck. It seemed I had to lower friction too much in order to get the tank to turn realistically, but the it was far too slippery. Gosh, these days, it's a completely different engine :)

Although I always follow progress, I haven't had the chance to play with newton in a little while. I'd LOVE to see how you're doing this! This would be far better than my crappy ray-cast tank.
The unProfessional
 
Posts: 131
Joined: Sun May 02, 2004 9:08 pm
Location: Southern California

Postby JernejL » Sat Jul 23, 2005 5:19 pm

anyone played the game called "wild metal" by dma design? it had IMHO very realistic tank model, it wasn't raycasted.

btw, for controls i'd suggest using insert/delete for left track control and page up / page down for right track control, home & end would be handbrake or a gearbox..
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Postby Sascha Willems » Sun Jul 24, 2005 6:14 am

Julio Jerez wrote:About the control, what I do is that I have two functions
One for the forward acceleration and one for the steering acceleration
Say f in the forward acceleration
And s in the stirring acceleration

Then I apply to one side r = f + s
And to the other l = f – s

The good thing about this is that it does not add extra movement when turning, for example if you just stop one tread you are subtracting momentum and that is a discontinuity. In general discontinuities are a bad thing.
With this method the net acceleration changes continuously and there is not need to come up with complicated controls scheme.


You're totally right. I implemented the above formula and I now my callback is not only smaller by a good amount I now only need one for both tracks (I get s via user data). This method also makes movement a bit more like it should be, but I still have problems at slopes. But those problems are not as annyoing as it was with the first demo, so I'll see if I can get them sorted out, but right now it already isn't acting too bad.


Julio Jerez wrote:I played some more and I think the canon bias the origin too much.

I assume that eventually it will be a linked part; if you get to do that then I think the origin should be biased, Now that I think of it, I always notice the American tanks like the MA1A have a very heavy turret that is skew to the opposite site of the cannon I assume that they had some counter way to avoid this effect.


Did that. The gun is now loaded as a separate NewtonBody and connected to the chassis. This makes a big difference when e.g. breaking and hopping over a hill.

Julio Jerez wrote:Tell me something German tanks were unable to rotate the turret? The way I see this is one big monolithic body and the turret can only move up and down.

The german's had a large amount of specialize tanks, and this one (called "Jagdpanther") was one special purpose tank. It was a tank-destroyer and the main goals when building such a tank hunter were a large and powerful gun, light weight and fast movement. So that's why this tank is so different from others (like the e.g. german tigers, which had the usual turrets), it was no normal tank. It should ambush the enemy tank, knock it out with it's powerful gun and then disappear, so there was no need for a rotateable turret. If you're interested, click here for more information on that tank.
User avatar
Sascha Willems
Moderator
Moderator
 
Posts: 346
Joined: Fri Aug 27, 2004 10:18 am
Location: Germany

Postby The unProfessional » Sun Jul 24, 2005 1:50 pm

What can I say, the Germans can build tanks well :) Including a tiger would be awesome.

Looking forward to the next demo!
The unProfessional
 
Posts: 131
Joined: Sun May 02, 2004 9:08 pm
Location: Southern California

Postby Sascha Willems » Thu Aug 04, 2005 6:09 am

I almost had no time at all for coding the last days weeks, so no update on this within the last days :(

But I changed some stuff during my few spare hours and also tried around. It's now working much better than in the first iteration but I think (but maybe I'm wrong) that this method won't work 100%. I think it has something to do with the number of contacts that are generated for each track. If I'm not mistaken the "speed" of a track with this method depends on the number of contacts generated between the track and the floor. So depending on the slope and direction of the tank on the terrain it's not working like it should.

Maybe there is some work-around on this or some way to solve it, but I don't know on how to get this right. I've put dozens of hours into tweaking it but never got it to work 100%. So I'd be glad for any input or ideas on how to get this proper.

On a side-note I also started testing out other methods for moving the tank. The first one I tried (besides the material-one) was moving it just using forces (applied to the tracks) which works to some extend and I guess that method can be tweaked to work properly.
User avatar
Sascha Willems
Moderator
Moderator
 
Posts: 346
Joined: Fri Aug 27, 2004 10:18 am
Location: Germany

Postby Stucuk » Thu Aug 04, 2005 8:12 am

when there is a contact between a track and the ground, couldn't u process only one of the contacts for each track. (basicaly when ones processed set a varible so the rest arn't processed for that frame).

That way u will only be applying the speed with one part of the track, so no matter how meny are touching it should go the same speed. I think.
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Postby The unProfessional » Fri Aug 05, 2005 3:05 am

Yeah. It almost seems like a ray-cast method might be best. :?
The unProfessional
 
Posts: 131
Joined: Sun May 02, 2004 9:08 pm
Location: Southern California

Postby Sascha Willems » Fri Aug 05, 2005 6:01 am

Stucuk wrote:when there is a contact between a track and the ground, couldn't u process only one of the contacts for each track. (basicaly when ones processed set a varible so the rest arn't processed for that frame).


Tried that, but it doesn't work. I guess only processing one contact for the track will never give it enough acceleration to start moving. And my observation seems to be right, as I'm now displaying number of contacts for each track after NewtonUpdate and the number differs per track, so I guess that's the cause for the "problem".
User avatar
Sascha Willems
Moderator
Moderator
 
Posts: 346
Joined: Fri Aug 27, 2004 10:18 am
Location: Germany

Postby Julio Jerez » Fri Aug 05, 2005 6:52 am

I think I know why that happen, and I might have a solution.
I will post it later tonight
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Postby Sascha Willems » Sun Aug 14, 2005 1:54 pm

(Note to Julio : I've read your post in the SDK developers section, so regard this as something seperate, I sadly haven't had the time to try out your suggestion you posted there)

I just fiddled around with this again and added debug visualization for the contacts generated by the tracks, so one can clearly see that there are not only different contacts generated for the two tracks, but that those contacts are even on different positions. See this screenshot for what I mean :

Image

Is that desired behaviour? Since I don't know about how newton picks it's contacts I don't know if this is right or wrong. Note that the tank was moving on flat surface and that both tracks are using the same mesh.
User avatar
Sascha Willems
Moderator
Moderator
 
Posts: 346
Joined: Fri Aug 27, 2004 10:18 am
Location: Germany

Postby Julio Jerez » Wed Aug 17, 2005 7:15 am

Oh I missed this post.

I see the problem. I think the excessive number of contacts have to be worked around with a clever collision design. Instead of making the threads piece by piece, I would make a single piece. That way the hull itself will filter the contacts.

I made a sample of two thread stiles.
Image
the first will generate contact that are separated to each thread side but it may also produce more unbalance.

The second is more like a wedge that will produce contacts only on each side of the tank.
With this style this each contact will generate better a traction model.

I had not tested this but I do not see any reason why it would not work, also it will be more stream lined as it will have fewer primitives and fewer contacts.
I hope the suggestion help.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Postby Sascha Willems » Thu Aug 18, 2005 3:49 pm

The second (dark yellow) hull is exactly what the convex collision hull of the tank's tracks look like. I'm not building it from different pieces or so, so that's not the cause for the different number of contacts generated. Maybe it has gotten something to do with the tree collision, cause I noticed that on a box the contacts are most of the time same for both tracks, whereas they're not (like I told above) when you drive on a flat part of a tree collision.
User avatar
Sascha Willems
Moderator
Moderator
 
Posts: 346
Joined: Fri Aug 27, 2004 10:18 am
Location: Germany

Postby Julio Jerez » Thu Aug 18, 2005 8:19 pm

Ah I see the problem is not the vehicle geometry but the landscape.
I was about to give up, but then I call up on the oracle and asked “oracle, Dark Master Sascha has come up with an idea that has great potential, it is a tracked vehicle that is only using contacts and friction to move around, but he is having problems with the contact location, what can we do to help him out with this problem?

And the Oracle replay “Localize the contacts with discrete geometries”, then it hit me the solution is to use multiple collision primitives to create contact in predefined location, and ant the same time only generate one contact. There is a special primitive for that the chamfer cylinder. So I when back and layout some geometry over a tank model toi give you a better idea

I chage the image take a look a let me know what you think?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

PreviousNext

Return to User Gallery

Who is online

Users browsing this forum: No registered users and 13 guests

cron