Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Angled Water Areas
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
#8
RE: Angled Water Areas

(05-23-2011, 05:54 PM)xiphirx Wrote: Yea, I'm able to rotate it too, but in game it acts as if its a giant cube instead of like how its supposed to...

I just tried making "steps" of water areas to emulate a slope. However, this doesn't seem to work.

I think the solution to this is going to require scripting buoyancy to a degree. Obviously we can't clip the shape by the area and calculate the submerged volume using current methods provided by the engine, so we are going to have to assume all objects are spherical - which unless you require perfect physics here is a fair sacrifice.

The idea is thus:
  1. Create a water plane as normal. This will be the surface.
  2. Create a thin script area running parrallel to the water plane. Call it liquid_1. This area should have a collide callback triggering on something like "object_*" with all floating objects prefixed with "object_". Have this call a function in your hps file on both entrance and exit.
  3. Duplicate the script area multiple times so we have various "slices" beneath the water area.
  4. Write some code to flag how many "tiles" each object is and store this information.
  5. For each object that is flagged apply a force away from the water based on how many tiles the object touches.
I am working on slapping some code together now Wink

Edit Done!
http://www.mediafire.com/?62ywej36g5w887w

Notes:
The values of the vector * volume displaced are VERY approximate. There is no reason why you shouldn't properly work out these values using some trig, and multiply them against volume. You could also produce a lookup table for objects and their volumes (remember to divide by the maximum no. depth objects they can flag), for much more precise forces when dealing with different sized objects. I am also not going to say right now this is bug free, it was put together in just under an hour (including writing this post), but it seems to behave fairly realistically considering. Finally, this WILL require some tweaking to get to work with saves, thanks to the use of the List class which wont be saved.

Edit 2: You can also apply the effects of current by changing the values of the vector*volume.
(This post was last modified: 05-23-2011, 10:02 PM by Apjjm.)
05-23-2011, 09:22 PM
Find


Messages In This Thread
Angled Water Areas - by xiphirx - 05-23-2011, 03:22 AM
RE: Angled Water Areas - by Russ Money - 05-23-2011, 03:59 AM
RE: Angled Water Areas - by Streetboat - 05-23-2011, 04:35 AM
RE: Angled Water Areas - by xiphirx - 05-23-2011, 05:12 AM
RE: Angled Water Areas - by palistov - 05-23-2011, 07:44 AM
RE: Angled Water Areas - by xiphirx - 05-23-2011, 05:54 PM
RE: Angled Water Areas - by Apjjm - 05-23-2011, 09:22 PM
RE: Angled Water Areas - by xiphirx - 05-23-2011, 10:59 PM
RE: Angled Water Areas - by nemesis567 - 05-23-2011, 02:09 PM
RE: Angled Water Areas - by palistov - 05-23-2011, 10:05 PM



Users browsing this thread: 1 Guest(s)