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

Pages: [1] 2

Author Topic: Help with .js?  (Read 4642 times)

StrakanXJ

  • Jr. Member
  • *
  • Posts: 30
Help with .js?
« on: October 21, 2016, 10:15:15 am »

I have many models, I have modded a few games previously (Spintires, Space Engineers, Skyrim...) so I deem myself able to learn quick enough but I find i learn better with text instruction I can read (and re-read!), making sure I have everything right.

I wanted to start my Outerra journey with a model I had been playing with for a side project I have, it is in Torque which uses a very similar language - which I am equally inept with at the moment. So I bring it here, I have it imported succesfully, Although I have yet to add materials/textures. First I want to get it moving. I understand there may be some problems inherant with 2 wheels vehicles, how do you keep them upright etc so Im prepared for this to not work fully but

can anyone hold my hand through the code for this so I can learn whats needed?
As I say I have a lot of models, vehicles, aircraft, water, static etc and I would love to contribute to this community. Im head over heels with the Tech demo, bought in as soon as I could and im keen to be able help in any way I may be able to?


Logged

KW71

  • Outerra Developer
  • Hero Member
  • *****
  • Posts: 701
  • Love OT!
Re: Help with .js?
« Reply #1 on: October 21, 2016, 11:10:43 am »

Hi!
I have been modeling for a while, but just recently I have touched js. As many here, I think that the best way to learn is to open an existing script and analyse it.

You need to see the wiki.

http://xtrac.outerraworld.com/wiki/TitleIndex

In this case start at the bottom of the index: vehicle, vehicle params, wheels, etc.

I have found this page very useful too:

http://www.w3schools.com/js/default.asp
Logged
"A man who is contented with what he has done, will never become famous for what he will do".

StrakanXJ

  • Jr. Member
  • *
  • Posts: 30
Re: Help with .js?
« Reply #2 on: October 21, 2016, 12:35:25 pm »

Thanks, I'll take a look ;)
Logged

StrakanXJ

  • Jr. Member
  • *
  • Posts: 30
Re: Help with .js?
« Reply #3 on: October 21, 2016, 06:50:21 pm »

Well, its a long way from working anything like I want it to but after a few hours of scratching my head I think im starting to scratch away the surface...I have my bike moving, even keeping itself upright, kinda, until it goes too fast over a bump and ends up rather 'animated'.
Ill get some materials on it, try to fine tune the settings and upload it somehwere in case somebody wants to help me polish it up a bit...
Logged

StrakanXJ

  • Jr. Member
  • *
  • Posts: 30
Re: Help with .js?
« Reply #4 on: October 21, 2016, 09:42:25 pm »

Well, heres a screen of the bike, partially .mtl, still trying to get it to ride properly but pretty happy with my first attempt.
Logged

KW71

  • Outerra Developer
  • Hero Member
  • *****
  • Posts: 701
  • Love OT!
Re: Help with .js?
« Reply #5 on: October 21, 2016, 10:08:22 pm »

Great! Keep going!
Logged
"A man who is contented with what he has done, will never become famous for what he will do".

andfly

  • Sr. Member
  • ****
  • Posts: 251
Re: Help with .js?
« Reply #6 on: October 21, 2016, 10:28:50 pm »

Well ....
If in half a day you are already succeeded (almost from zero) to obtain the results for the first movement of a model ...
I think you have a good predisposition to become an excellent modder !!!

I allow me some advice deducted from my personal experience:
Also read the files JavaScript that run the models of the other modders ... they are an inexhaustible source of inspiration!
Especially because you compare yourself with the known good code, and you can see, in practice, the results!

A huge: Welcome StrakanXJ !!!
Logged
I do not know the English language. I use Google Translate. I hope it's all understandable.

StrakanXJ

  • Jr. Member
  • *
  • Posts: 30
Re: Help with .js?
« Reply #7 on: October 22, 2016, 07:59:58 am »

Thanks guys ;)
Where is the best place to aquire those mods from other modders? I have a couple from the forum but just wondered if there was a hidden cache somewhere im missing out on? :P
A little closer with my bike, It rides a little better (but not perfect), the handlebars move and it doesnt want to flip out quite so much. Would anyone mind having a look at it to give me some pointers? Ill upload it after a few more tweaks to the model...
« Last Edit: October 22, 2016, 08:08:14 am by StrakanXJ »
Logged

andfly

  • Sr. Member
  • ****
  • Posts: 251
Re: Help with .js?
« Reply #8 on: October 22, 2016, 04:17:39 pm »

Thanks guys ;)
Where is the best place to aquire those mods from other modders? I have a couple from the forum but just wondered if there was a hidden cache somewhere im missing out on? :P

The best place to acquire new models is this forum.
Exploring (in all its pages) sections Aircraft, Vehicle and Watercraft you can find many mods published and the links to download them and try them.
The more "old" may not work perfectly because the versions of Outerra, that have occurred over the years have changed and improved different things (like managing commands), but the basic principles have remained the same.
The installation file "OTX" will write you a folder with the name of the model in your "packages" folder (usually in "Outerra" folder of your documents), and there you will find the command ".js" file.
You can also explore the folder "packages" that is in the program folder (C: \ Program Files (x86) \ Outerra \ Anteworld). There you'll find the default models accompanied by the respective JavaScript files.

With your interest in motorcycles ... a couple of links:
Yamaha motorcycle by the very talented giucam: http://forum.outerra.com/index.php?topic=1940.0
Discussion on two-wheeled vehicles: http://forum.outerra.com/index.php?topic=2796.0

Good luck and have fun !!!

P.S.
From your last post I understand you've already started exploring the forums on the hunt for models ... once again have anticipated the times ... congratulations for speed!
I do not think you have a great need help ... (however, in the case, do not hesitate to ask)
... Soon, probably, they will be others to having to ask for help !!!
Logged
I do not know the English language. I use Google Translate. I hope it's all understandable.

StrakanXJ

  • Jr. Member
  • *
  • Posts: 30
Re: Help with .js?
« Reply #9 on: October 22, 2016, 04:34:47 pm »

Thanks andfly, I have read some of these forums as a matter of course and your name has accompanied some rather nice posts. I have a couple of your models already ;) Blown away by them to be honest so your commendation means a lot to me, sincerest gratitude.
Thanks for the links, any help at this point is really appreciated!

EDIT:Sadly many of the files around here have broken links...either that or they dont seem to work in OT...performance errors, outdated etc.

I have a couple that work though so Ill see what I can glean from them.
« Last Edit: October 22, 2016, 06:03:53 pm by StrakanXJ »
Logged

StrakanXJ

  • Jr. Member
  • *
  • Posts: 30
Re: Help with .js?
« Reply #10 on: October 24, 2016, 04:14:46 am »

This really isn't my Forte...
Borrowing code from the default vehicles gives me an error:
'use of const in strict mode' - Im baffled. Why does this work for some vehicles but not mine!? What am I doing wrong?
For example, I have a BMW E46 M3 model, not finished. I used the SM11 bus code, deleted the lights etc and hit reload. Gives me the error. So (admittedly not knowing what to do) I change const to var. No errors but it doesnt drive. I set engine = 10 (update_frame) and I now have...something. It moves when I press W, it steers. It locks the wheels up when I press S and it comes to a stop eventually. Unless It goes into 'parked' though, the wheels keep exerting force. No doubt due to my hack...but why is const not working...and how can I get it to drive like it should?
I could copy+paste the code up here, if any of you are willing to risk making your eyes bleed to look at it :/
Logged

andfly

  • Sr. Member
  • ****
  • Posts: 251
Re: Help with .js?
« Reply #11 on: October 24, 2016, 01:54:37 pm »

I state that I am not a great expert.
I did not know JavaScript, and 3D modeling very little, until I discovered Outerra.
I fell in love and wanted to "be there."
So I downloaded some manual from the Web and I "forced" to learn how to take advantage of this wonderful world and I learned just enough to build my models.

However I think I can help a little ...

When you import a model in Outerra is created ".objdef" file, in the latest versions, it includes the definition: "strict": true,
Apparently, in "strict", is not allowed the use of "const" and models created with older versions (which made use of the constants) cause an error.
It is easy to fix:
   Unless we change, "strict": false, in ".objdef" file.
   Or it changes "const" with "var".
Maybe it's better the second option because the mode "strict" should carry out a more rigorous grammar checking on the code, and this is still a good thing.
(You will notice that the ".objdef" file of the SM11, even if it is a default model, does not contain references to "strict mode" because it was written, and maintained that, for an earlier version).

As for the movement ... I have to raise my arms:
I have not yet built ground vehicle models with wheels and I have not examined the subject ...

The only small additional tip is to make sure you tell the program the definition of the wheels with the name by which it was imported.
You are obtained with the command "this.add_wheel ( 'XXX', wheelparam);"
Instead of "XXX" You must write the name by which the wheel has been defined in the graphics file (or any other name if, when importing, you have changed the name).
In this way the command: "this.animate_wheels ();" should make the wheels turn, transmit the force on the ground and to advance the vehicle.

And then one other link: http://forum.outerra.com/index.php?topic=1946.0
It posted a long time ago but, in basic things, still relevant.

For more specific and particular problems I leave the floor to modders more experienced than me.
You continue to ask if you get stuck.
Surely someone will answer you!

Still good job and have fun!
Logged
I do not know the English language. I use Google Translate. I hope it's all understandable.

StrakanXJ

  • Jr. Member
  • *
  • Posts: 30
Re: Help with .js?
« Reply #12 on: October 24, 2016, 03:30:45 pm »

Thank you again andfly!
I have been tearing some of the .js files to pieces and I have managed to beg borrow and steal enough to get my 4 wheeled vehicles moving, stopping, reversing, steering and so far even the steering wheel animated.
Unfortunately the model I am using is poor and needs a bit more time spent on it. Also Im only using materials thus far. I dont do much UV mapping or texturing but I think I know what Im doing....
Also the driving is far from realistic and I fear it may take someone more adept at this than I to fix it so as soon as Im half-way satisfied with the model (currently ripped it down and basically rebuilding it) ill make it available for anyone willing to have a tinker.
I had a quick shot at making a boat and that went smoothly enough, Ill have a proper go at that in time, too.

I must admit im no veteran at 3D modelling either, its just a hobby that, thanks to open source, I dont have to spend any money on. I am willing to learn, though...
Logged

StrakanXJ

  • Jr. Member
  • *
  • Posts: 30
Re: Help with .js?
« Reply #13 on: October 25, 2016, 02:57:41 pm »

Logged

StrakanXJ

  • Jr. Member
  • *
  • Posts: 30
Re: Help with .js?
« Reply #14 on: October 27, 2016, 11:03:55 am »



Still working away...Ill start playing with materials soon, its too shiney and plastic looking for my liking atm.
Logged
Pages: [1] 2