DMagic Posted November 24, 2015 Share Posted November 24, 2015 I'm looking for a way to decide if a specific part is under water. I would like to know if it is in contact with the water and if it is entirely submerged and its depth. I'm looking at Part and PartBuoyancy, but I'm not sure exactly what all of the values are. Are Part.depth and PartBuoyancy.depth the same? Do they represent depth underwater? Will PartBuoyancy.submergedPortion tell me the percentage of the part (or its collider, or maybe drag cube) that is underwater as the name suggests? I assume Part.WaterContact is true if any amount of the part (or whatever stands in for the part) is underwater. I could probably check all of this in-game :P, but I won't have a chance to get to it for a few days. Link to comment Share on other sites More sharing options...
NathanKell Posted November 24, 2015 Share Posted November 24, 2015 Part.submerged (or is it submergedPortion?) defines what ratio of the part's total displacement is under water. PartBuoyancy sets it each tick, but use the Part version since that means your mod will work with any mod that replaces PartBuoyancy. If you do want depth (depth at centerOfDisplacement), minDepth (depth at part's highest point, more or less), or maxDepth (depth at part's lowest point, more or less) then you do have to go into PartBuoyancy. Link to comment Share on other sites More sharing options...
DMagic Posted November 25, 2015 Author Share Posted November 25, 2015 Thanks, that more or less confirms what I thought. I went ahead and checked this in-game, just in-case anyone else is looking for the same info. The Part. depth, minDepth, maxDepth, and submergedPortion all give equivalent values to their Part.PartBuoyancy equivalent. submergedPortion gives a 0-1 percentage. The depth values give a number in meters below the surface, and return negative values when above the surface. And WaterContact returns true only when the part itself is actually partially, or completely, submerged. Link to comment Share on other sites More sharing options...
NathanKell Posted November 26, 2015 Share Posted November 26, 2015 Ooh, awesome, I [I]did[/I] remember to add part-side copies! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now