Author Topic: At least one Splash & Hydroplaning things  (Read 4620 times)

Leucome

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • leucome.ca
At least one Splash & Hydroplaning things
« on: April 07, 2014, 09:30:26 AM »
I noticed that object who fall into water without any x or z velocity  did not emit any splash.

Or also when the player jump outside water it do not splash.

So I made some change to the script to get at least one splash when an object enter or exit water. I think it may be a good idea to add this feature to suimono.

To do it we can  change the water_splashHandle.js
Something like add a variable  EmitOnce = true;   to the function OnTriggerEnter   and     function OnTriggerExit and add  || EmitOnce==true  to the (if condition that trigger a splash)   finally  EmitOnce = false;  at the end  .



I also made an other buoyancy script that take speed into account to make  Hydroplaning things,  like ski nautic,   bouncing rock  on water,  snowmobile and ATV that are able to cross lake.


Anyway if someone is interested to add such feature the change done to the buoyancy script look like this with the gravity set to true so the object can sink if there are not enough speed .

Code: [Select]
if (buoyancyFactor > 0.0){
this.rigidbody.useGravity = true;
                         spd = this.rigidbody.velocity.magnitude;
this.rigidbody.AddForce((Vector3.up*buoyancyFactor*(spd/100)),ForceMode.Acceleration);








Finally I found a way to get more subtle variable sound volume based on the velocity in watermodule_splasheffects.js   basicaly I divided the velocity by 10  if not the sound almost always get max volume .

Code: [Select]

if (Mathf.Abs(sndVelocity.z/10) >= setvolume) setvolume = Mathf.Abs((sndVelocity.z/10));
if (Mathf.Abs(sndVelocity.y/10) >= setvolume) setvolume = Mathf.Abs((sndVelocity.y/10));
if (setvolume > maxVolume) setvolume = maxVolume;
//setvolume = maxVolume;


 
« Last Edit: April 07, 2014, 10:01:28 AM by Leucome »

Chingwa

  • Administrator
  • Hero Member
  • *****
  • Posts: 1704
    • View Profile
    • Tanuki Digital
Re: At least one Splash & Hydroplaning things
« Reply #1 on: April 08, 2014, 08:57:50 AM »
That's great leucome!

Just FYI the 2.0 update calulates the wave interaction slightly differently.... if you have 3d waves in the scene (2.0 only) then the system doesn't register trigger collisions with the water, you need to call the SuimonoGetHeight() function to determine whether an object is intersecting.... but again this all just for the 2.0 version.

What you've done here seems like it work really nice for the current version!

Leucome

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • leucome.ca
Re: At least one Splash & Hydroplaning things
« Reply #2 on: April 08, 2014, 01:37:12 PM »
Thanks ! It will be useful to know the SuimonoGetHeight() function.
 3D  wave are a quite interesting feature. :)  I downloaded it and tested the prefab surface so far.