Outerra forum

User mods, screenshots & videos => Other => Topic started by: fly77 on February 17, 2019, 04:56:45 pm

Title: custom explosion sounds for impacts of different types of objects launched ?
Post by: fly77 on February 17, 2019, 04:56:45 pm
I have changed the explosion sound in  "C:\Program Files (x86)\Outerra\Anteworld\sounds"   with a more realistic one for missile impact for my missile launcher: I am launching my missile object using the $explosions.launch_tracer  command ( followed by $explosions.launch_combo  to get a crater and smoke). In "C:\Program Files (x86)\Outerra\Anteworld\sounds" there is just one "explosion.ogg" and so it seems only this name can be used and so only one type of sounds seems to be vailable for all types of explosions. I'd like however to have different sounds for impacts of different types of objects launched.
Is it possible and if so where can I set the sound that is to be used for a given object launched ? I
Title: Re: custom explosion sounds for impacts of different types of objects launched ?
Post by: fly77 on February 17, 2019, 06:52:51 pm
hmm...  got an idea: I'll try to use    void set_source_ecef( uint source_id, const double3& pos );    and get the pos from  tracers landed and play my custom sound on impact controlled by the launching vehicle setting the source to the retrieved impact location. It seems indeed possible to call  set_source_ecef in update_frame to change the sound source dynamically. Will try it
Title: Re: custom explosion sounds for impacts of different types of objects launched ?
Post by: fly77 on February 19, 2019, 01:59:15 pm
While my tracer and missile shoot OK and produces an impact I can't get any info out form $explosions.landed_tracers(). I tried to figure out what is the reason as below. I get that $explosions.landed_tracers() is recognized always as an object but any of its properties remain permanently undefined. Any hint to where is my mistake ? Seems as if no tracer is ever landing.


Code: [Select]
function init_vehicle(){
...
   $explosions = this.$query_interface("ot::js::explosions.get");
   tracer = $explosions.launch_combo( ecef, {x:75*plasmaquat.x, y:75*plasmaquat.y, z:75*plasmaquat.z}, 10, {x:1,y:1, z:0},  {x:0.3,y:0.3, z:0.3}, 7, 0.1, 0.1, 20, true, true, true );
   $explosions.destroy_tracer( tracer );
...
}




function update_frame(dt, engine, brake, steering)
{
...
 if( typeof($explosions.landed_tracers())=== null){ 
      info="null";
  }   
  if( typeof($explosions.landed_tracers())=== "undefined"){ 
      info="UNdefined";
  }   
  if(typeof($explosions.landed_tracers()) === 'object'){
      info = "object";             
      if( (typeof($explosions.landed_tracers().wpos) === "undefined")){
          impact_pos = "UNdefined";
      }else{
          impact_pos = $explosions.landed_tracers().wpos.x;
      }     
      if( (typeof($explosions.landed_tracers().hitid) === "undefined")){
          hitid = "UNdefined";
      }else{
          hitid =$explosions.landed_tracers().hitid;
      }     
      if( (typeof($explosions.landed_tracers().attid) === "undefined")){
          attid = "UNdefined";
      }else{
          attid =$explosions.landed_tracers().attid;
      }

  if (fire_switch == 1){ 
    info = 0;
    hitid=0;
    attid=0;
    mesh=0;
    impact_pos=0;
   
     $throw = world.create_instance("outerra/missile/missile", ecef, plasmaquat, false);     
     entid = $throw.get_geomob(0).get_eid();

     $explosions.launch_tracer( ecef, {x:75*plasmaquat.x, y:75*plasmaquat.y, z:75*plasmaquat.z}, 10, {x:1,y:1, z:0},      0.5, 0.2, 0,    0,  tracer , entid , 0 );
     tracer = $explosions.launch_combo( ecef, {x:75*plasmaquat.x, y:75*plasmaquat.y, z:75*plasmaquat.z}, 10, {x:1,y:1, z:0},  {x:0.3,y:0.3, z:0.3}, 7, 0.1, 0.1, 20, true, true, true );

  }
...
}
Title: Re: custom explosion sounds for impacts of different types of objects launched ?
Post by: cameni on February 22, 2019, 01:09:55 am
landed_tracers should be an array of objects, it has wpos property with the coordinates.
Title: Re: custom explosion sounds for impacts of different types of objects launched ?
Post by: fly77 on February 22, 2019, 03:29:00 am
yes i understand but when I tried this

if ($explosions.landed_tracers().length>0){
 $explosions.landed_tracers()[0].wpos.x
}

I allways get error "Cannot read property 'x' of undefined "
Title: Re: custom explosion sounds for impacts of different types of objects launched ?
Post by: cameni on February 22, 2019, 03:56:14 am
Ah sorry the property is internally named wpos but in JS it's aliased to "pos".
Title: Re: custom explosion sounds for impacts of different types of objects launched ?
Post by: fly77 on February 22, 2019, 03:58:30 am
yes ! great ! now it works. Thank you cameni  :)
Title: Re: custom explosion sounds for impacts of different types of objects launched ?
Post by: fly77 on February 24, 2019, 04:51:09 pm
Testing my new upgraded abrams tank  =D

https://vimeo.com/319349565 (https://vimeo.com/319349565)
Title: Re: custom explosion sounds for impacts of different types of objects launched ?
Post by: aWac9 on February 24, 2019, 05:29:26 pm
This is very good .. I like it. :)
Title: Re: custom explosion sounds for impacts of different types of objects launched ?
Post by: fly77 on February 24, 2019, 05:30:31 pm
definitely fun !  working on some other aspects of it before release