Jump to content
The Dark Mod Forums

Water


Destined

Recommended Posts

Hi all,

 

I tried to add a floating boat to my WIP, but as soon as I tested, how it looked in-game, it immediately sank. After checking the properties, I noticed, that the boat has a density of 0.5, while the water has a density of 0.0015. I checked the def files and found this comment:

 

 


// density of water is 998kg/m³ at 20° C, however, our moveables usually
// have realistic masses coupled to a collision model that is slightly
// too big (since they are very inaccurate), so we drop the density slightly
// to make them properly sink (the default is 0.001043):
"density" "0.0015"

 

Frankly, I don't understand this number for the density. If the density is around 1000 kg/m^3, why is it smaller by a factor of 1000000 compared to kg/m^3 and even a factor 1000 compared to 1 kg/L in TDM? The other point I wanted to get at is: It should be stated somewhere which units are used to describe the density for players that want to work with buoyancy. I suppose the creator of the boat thought something like "Water has a density of 1 kg/L, so lets make the boat 0.5, so it floats." and made it far too dense by accident. The Wiki describes how to create water and visibility etc, but does not describe density anywhere...

I will check the density values of other entities (and materials) when I come home this evening and will check if there are other entities that should float, but won't, because a too high value. Maybe I can then give a list, where this should be changed (if there actually are more entities that use density).

Edited by Destined
Link to comment
Share on other sites

Ok, I did some testing and found out, that all moveables have a density spawnarg of 0.5 and if so they float on water (at least the crates, the barrel and the plank I found). I increased the value for one crate: 0.8: it still floats; 1 it sinks. This seems to be the threshold (for crates, at least). The boat also has a density of 0.5, but does not float. I thought, maybe it has to do with its mass (500), but reducing that to 50 also had no effect. What I still don't get: When the density of the liquid is 0.0015, why do objects wiht a density of 0.5 float? Maybe I am missing something here. Can anyone help? I would be fine with the boat floating on the water, actually.

Link to comment
Share on other sites

In general Doom 3's physics just arent as complete or integrated into gameplay as something like Half Life 2. There are sadly a lot of things that just don't work outside of the most basic simulations :/.

But you should walk having internal dignity. Be a wonderful person who can dance pleasantly to the rhythm of the universe.

-Sun Myung Moon

 

My work blog: gfleisher.blogspot.com

Link to comment
Share on other sites

Revamped physics was 4th on my pipedream list, after stand-alone, softshadows, and multiplayer. Well we got one of them and another in the pipe, so anything's possible.

 

I'm guessing density for objects and water have to be different units to explain something like that. And on top of that no doubt id4 has some shortcut method. The actual physics of floating is technically the weight of water displaced relative to the object's weight, which density relates to depending on what it's actually measuring.

What do you see when you turn out the light? I can't tell you but I know that it's mine.

Link to comment
Share on other sites

As stated in my first quote, the density of moveables is apparently calculated by dividing the defined mass by the volume of the collision model. I think I read that the density spawnarg is supposed to override this calculation. But it might also be, that this is a factor by which the calculated density is multiplied. This would at least explain, why the crate sank with density = 1. The question would be: Which mass is defined for func_liquids and is the mass actually depending on the brush size used? Getting behind all this would require more testing than I am willing to do.

 

The actual physics do definitely not apply, because a floating object stays floating even if another object with greater mass (i.e. the player) jumps on them. During my testing on Fryday I jumped on a small plank that did not sink, when I jumped on it. So I believe, the engine just compares densities and from them defines, whether an objects floats or doesn't. I still have not found an explanation for the sinking boat though... Maybe I will really just take Moonbo's advice and create a func_bobbing. Still it bugs me :(

Link to comment
Share on other sites

At a guess, I'd say that the tiny density numbers are for doom units cubed, not m3.

 

There are competing mechanisms here -- spawnargs overriding very rough calculations. I put in a fix for the mass of certain moveables in 2.04, and we'd better make sure that it doesn't make everything float in water during beta!

Link to comment
Share on other sites

  • 2 months later...

Just today I found out that the boat works perfectly fine. The problem seems to be another one. I placed the boat around the height of the water surface but on map start it is not there but on the bottom of my water entity, which is why I assumed that it sank. However, when I dived down there and touched the boat it resurfaced and floated on the water. So the problem is not theat the boat does not float but that the boat is put on the bottom (either during dmap or at map start) and seems to get stuck there somehow. Maybe it is possible to prevent this "getting stuck" and finally have the boat float as it should...

Link to comment
Share on other sites

I already tried that. My suspicion is, that during dmap or map start TDM checks for moveable objects, that are in mid-air and moves them along the z-axis until they touch static object. Apparently the water is not recognized as solid and thus the boat is moved to the bottom. The only thing I don't understand is why it gets stuck. I would have expected that as soon as the boat is registered as a movable object in the water the physics engine would kick in. Maybe I should try the other way around and put it on the bottom to see if it will resurface. I will try that this evening.

Link to comment
Share on other sites

Yep, nodrop did the trick. The boat is not floating initially and still has to be touched by the player for the physics engine to kick in, but this could simply be done by placing the map start on top of it. Thanks a lot!

Ironically, I am currently thinking about sinking the boat, as it makes more sense for the story. The boat was used to get to the target location and should raise suspicion as soon as a guard sees it. The exit is planned from the start to be a different one, so the thief would be better off, if he had sunk the boat. Will think bout it...

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 3 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
    • The Black Arrow

      I wanna play Doom 3, but fhDoom has much better features than dhewm3, yet fhDoom is old, outdated and probably not supported. Damn!
      Makes me think that TDM engine for Doom 3 itself would actually be perfect.
      · 6 replies
    • Petike the Taffer

      Maybe a bit of advice ? In the FM series I'm preparing, the two main characters have the given names Toby and Agnes (it's the protagonist and deuteragonist, respectively), I've been toying with the idea of giving them family names as well, since many of the FM series have named protagonists who have surnames. Toby's from a family who were usually farriers, though he eventually wound up working as a cobbler (this serves as a daylight "front" for his night time thieving). Would it make sense if the man's popularly accepted family name was Farrier ? It's an existing, though less common English surname, and it directly refers to the profession practiced by his relatives. Your suggestions ?
      · 9 replies
    • nbohr1more

      Looks like the "Reverse April Fools" releases were too well hidden. Darkfate still hasn't acknowledge all the new releases. Did you play any of the new April Fools missions?
      · 5 replies
×
×
  • Create New...