Outerra forum

User mods, screenshots & videos => Aircraft => Topic started by: wayne57 on April 10, 2014, 11:35:48 pm

Title: Prop question
Post by: wayne57 on April 10, 2014, 11:35:48 pm
How do you animate a prop and add sound to it
I'm still new at this and trying to learn

thanks

wayne57
Title: Re: Prop question
Post by: PytonPago on April 11, 2014, 01:42:00 am
All is done in java script .... you have to import the object as a vehicle (for now - will be done else-way in the future). Also, all moving pasts have to be separate meshes and their origins (pivot-points) are used as rotation axes - you need to pace them accordingly for rotations and movement.

Once you got the model in, you have to define the meshes you want to use in scripts in the "init-vehicle" section (those are shown in the base script of vehicles, once you open the .js file or hit "Alt + E" in game whyle being in the "vehicle") -

Code: [Select]

this.geom = this.get_geomob(0)

  this.br_id = this.geom.get_mesh_id('Wheel_BackRAc');

  this.clockb = this.geom.get_joint('TimeB');


The first line is as a definition of the mesh-detection/definition script. Mesh_id´s are used for hiding and showing meshes, the other for rotations and translations, where :
  this.clockb is the name you use in scripts for the mesh and ('TimeB') is the mesh name in the model (as you can see in blenders mesh-tree).

visibility of the _id´s are set via  :

Code: [Select]
this.geom.set_mesh_visible_id(this.br_id, false);
where the false/true says if it is rendered or not.
Rotations and translations are done like this in the "for every frame" section :

Code: [Select]
   this.geom.move_joint_orig(this.dlw, {x:0,y:0,z:-this.d1.value});
 
 this.geom.rotate_joint_orig(this.fuelmeter, Fuel, {x:0, y:1, z:0});

where this.d1.value is the value of translation along the Z axis (cause there it is and x:0, y:0 - also see, there is a minus before the value, so you can choose the rotation side) and Fuel is the value of rotations (in radians) along the y axis.  ... whyle, the values can be aether constants or function based. Best to see the integrator way on the bus script or you get them from the wheels etc. - see for more and better options in the wiki :

http://xtrac.outerraworld.com/trac.fcgi/wiki/vehicle (http://xtrac.outerraworld.com/trac.fcgi/wiki/vehicle)

If youre not much into the java-script, you have to just modify existing ones from the stuff people posted on the forum (or assemble your own) by try and error method. It may be a little frustrating at first, but you get the way it works eventually. 
Title: Re: Prop question
Post by: M7 on April 11, 2014, 09:48:14 am
You're a very patient guy Pyton. I dont know if Wayne will be able to use these insights, i know i always appreciate to see new explanations of how script works.
Title: Re: Prop question
Post by: wayne57 on April 11, 2014, 10:21:12 am
Well i thank you all for the replies and will try to follow the tutorials although i dont know anything about
scripts or coding i can try. i am more of a modeler thern c coder. made my first plane fly thanks to the great people like you guys
who helped. Although it was unstable at low altitude it did fly so i guess thats a start.

thanks again

wayne
Title: Re: Prop question
Post by: PytonPago on April 14, 2014, 04:57:35 pm
... i am more of a modeler thern a coder ...

 ... well, to boost you up, i started the same. :D ( not yet any close to a good coder, but i can do a few stuff i need  :) ) Also, Planes are a hard thing there - handled by JSBSim. But few people already used the mig-29 script they modifyed for their use, so try and error will work eventually for aircraft too. Doe, more fancy stuff will need to get into the JSBSim more in detail - but, maybe there will emerge something once you get a hold of the vehicle scripts and some js basics.

You're a very patient guy Pyton.

Snakes are patients little bastards - we just lie down in the rivers depths, chillingly hibernating the week away ... :D