• Welcome to Battlezone Universe.
 

News:

Welcome to the BZU Archive dated December 24, 2009. Topics and posts are in read-only mode. Those with accounts will be able to login and browse anything the account had access granted to at the time. No changes to permissions will be made to be given access to particular content. If you have any questions, please reach out to squirrelof09/Rapazzini.

Main Menu

unit collision detect

Started by Saloei, August 16, 2006, 05:23:50 AM

Previous topic - Next topic

Saloei

my units don't have collision detection. they crash into one another and try to go through each other, and succeed after a minute or so. when i see it, i have to direct them to go around the unit point for point or they'll just continue melding through. some get stuck!
this all started with the Beta patches.

Marksman

I saw something similar.

In instant action, I had two scavs roaming around. I called one over and it didn't come. I went to investigate and found them inside each other.

It looked almost like one scav, standing still. They were pointed the same direction in the same position. Only slight edge variations gave away that it was two scavs. I rammed them and pushed them forward. This caused them to roll forward at slightly different angles and eventually drift apart and become two scavs again.

So there is some kind of collision problem, but when they do collide, they stick and it hinders them from doing anything else.

lucky_foot

That's weird. I thought that we worked on that merging issue.......
Jonathan S.



wug

We did, but as hard as GSH tried, he couldn't get the treaded physics to work consistently. :oops:

llulla

Isn't it possible to "imitate" the 1.2  logic  or the code is copmletely different in 1.3? I see BZ boxes system looks the same. Any parameters or constants than can be experimented upon? 

Avatar

Some points about treaded unit collision...

Battlezone units were intentionally made a little ghostly to allow their limited AI to eventually push through buildings they were stuck in/on/against.  When BZ2 introduced treaded units the physics of the treads didn't work well with shoving through a building, causing them to get permanently stuck.  Nathan worked long and hard on several ways to stop this, but it's always better to avoid the collision entirely than try to make the collision harmless.

To do that:

Remember that most units use a bubble for colliding.  Give the unit a shield and shoot it to see this bubble.  If any part of the unit sticks out of the bubble you'll have trouble when colliding with buildings.  If that's the case either give the unit a larger "collisionRadius" entry OR try "boxCollide=1".  People have reported mixed results with boxcollide, but I found it helped long, skinny treaded units collide when they actually bumped each other rather than after they'd already merged.  They may still merge as there are other factors involved in collisions.

Someone reported that collisions also depend on unit speed, so slow speed collisions are more likely to cause merging.

The AI insists on doing some things that help cause collisions, such as backing up and turning before finally moving forward.  Red Devil had some success limiting this, maybe he'll chime in on how he did it...  (personally I think treaded units should spin in place, and almost never back up, but that's just me...)

Don't go too nuts with "collisionRadius", as above a certain size will cause the unit to path funny.  For instance, too large a value will prevent them from being able to use bridges, or make them go all the way around a cliff, or not be able to approach the Service Bay, that sort of thing.  Use a radius just large enough to prevent them from ramming each other casually.

When making treaded units try to keep it real...  too large or too small has problems without serious physics tweaking.  Read the 1.3 changelog for all the new treaded unit physics options...  some of them really help but require a lot of work to tweak properly for custom units.

-Av-
(bored out of his mind at work...)


Red Devil

I experimented heavily with collisionRadius while testing 1.3 and got very good results.  Vehicles would all go to the Goto point and then spread out nicely.  That really helped with units in groups all being able to fire instead of just a few.

I also got the treaded units to rotate in place for turning purposes so they wouldn't do that 3-point turn and get stuck in things.
What box???

llulla

Which files should we manipulate for testing the collision thing, Red Devil?

Red Devil

The vehicle files, like ivatank.odf, fvatank.odf, etc.  They're in the .pak files.  Newer ones are in patch13.pak, older ones in data.pak. Use PakExplorer to extract them, a text editor to edit them.  Stick 'em in your addon folder to override the ones in the pak files.
What box???

llulla

You mean, each tracked vehicle needs fixing? O.K. What is your suggestion for the parametet value, what gave you better results?

Thanks

Red Devil

It's not just one value.  It's many values all working together.  I put many dozens of hours into it about year or more ago and I don't know what I've done with it. Best way is to just dive in and work it out.
What box???

llulla

I am not very familiar with the .odf structure and parms. Is there any handy documentation so I read it myself and not be of nuisance to you?
Right now browsing inside ODFs I could spot only a section called [trackedVehicle] that, I suspect, is related to the matter we are dealing.  My eye did not catch a "collisionradius" line but I will see more carefully.

Red Devil

You're not a nuisance and I'm not sure there's any documentation for it.  You'll probably have to add the collisionRadius entry to the ODF, like this:

collisionRadius = 8.0

To make things easier, you can fire up an Instant Action map, then Alt-Tab, tweak the ODF's, save them, then Alt-Tab back to the game, then build the unit(s) again to see the effect (might have to demolish/rebuild the factory so it will pull in the changes).
What box???

Angstromicus

Do such changes work with every thing, except just units? Perhaps weapon effects and renderings?

Red Devil

 Yes, they should if i remember correctly.
What box???