Outerra forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Outerra Tech Demo download. Help with graphics driver issues

Author Topic: custom explosion sounds for impacts of different types of objects launched ?  (Read 479 times)

fly77

  • Sr. Member
  • ****
  • Posts: 433

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
« Last Edit: February 17, 2019, 05:08:10 pm by fly77 »
Logged

fly77

  • Sr. Member
  • ****
  • Posts: 433

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
« Last Edit: February 18, 2019, 12:47:45 pm by fly77 »
Logged

fly77

  • Sr. Member
  • ****
  • Posts: 433

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 );

  }
...
}
« Last Edit: February 19, 2019, 02:13:49 pm by fly77 »
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6622
  • Pegs is clever, but tae hain’t a touch sentimental
    • outerra.com

landed_tracers should be an array of objects, it has wpos property with the coordinates.
Logged

fly77

  • Sr. Member
  • ****
  • Posts: 433

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 "
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6622
  • Pegs is clever, but tae hain’t a touch sentimental
    • outerra.com

Ah sorry the property is internally named wpos but in JS it's aliased to "pos".
Logged

fly77

  • Sr. Member
  • ****
  • Posts: 433

yes ! great ! now it works. Thank you cameni  :)
Logged

fly77

  • Sr. Member
  • ****
  • Posts: 433

Testing my new upgraded abrams tank  =D

« Last Edit: February 24, 2019, 04:58:36 pm by fly77 »
Logged

aWac9

  • Hero Member
  • *****
  • Posts: 1251
  • newbie

This is very good .. I like it. :)
Logged

fly77

  • Sr. Member
  • ****
  • Posts: 433

definitely fun !  working on some other aspects of it before release
Logged