User mods, screenshots & videos > Watercraft

Mooring or Anchoring Watercraft

<< < (2/2)

andfly:
You have defined 2 times a function with the exact same name (update_frame) ....
this is not allowed in any programming language ...

You must delete the lines:

function update_frame(dt, engine, brake, steering){
var f = 4000000*(engine-brake);
this.extra_force({z:2,y:-70},{x:2000000*steering,y:f});
}

and enter the commands:
var f = 4000000*(engine-brake);
this.extra_force({z:2,y:-70},{x:2000000*steering,y:f});

within the update_frame function that you define immediately after.

The presence of two commands this.extra_force, in a function, is not an error!
the model will simply be subject to two forces instead of just one !!

The model does not float for any particular property ...
The execution of the script stops (due to the error) and the simulation stops before the ship manages to touch the surface of the water.

Bob425:
All sorted now, thank you Andfly.

I was getting the same problem with the boat in mid air, so I went to the eng log file and got the following:-

ERROR: vehicle::init_chassis
file:///Outerra/packages/Bob425/Rotterdam/Rotterdam.js(32): SytaxError:
Duplicate data property in object literal not allowed in strict mode
(ot::vehicle_physics::load_script(): )

Line 32 read:-
this.extra_force ({z: 0, y: 0, z: 0},

when of course it should have been:-
this.extra_force ({x: 0, y: 0, z: 0},

All is now fine, and my thanks go to you for all the trouble you have taken to help me.
(Programming does not come easy when you are nearly eighty years of age)

Bob.

andfly:
Acc ... Bob ...     :o

I am extremely admired of your ability to establish a (and profitable) confrontation with a reality in frenetic progress such as the use of computer systems ...
And not just as a simple user, but with the intention of mastering them with programming ...
It is a world that creates difficulties even for the children who were born there.
For those who have reached a more mature age constitutes (in most cases) an insurmountable obstacle!
My admiration, above all, to the ability to thrill and excite you that is sensible by the stubbornness with which you wanted to "go to the bottom" in solving the problem of the boat.
I always thought that only this ability is the true index of a person's age ... beyond what the personal documents say ...


I apologize for my error in haste that has created difficulties for you.
Actually I wrote a "z" instead of an "x", but you have solved it without problems!

I'm glad you're OK now.
If you need further advice or information, do not hesitate to use this forum.

It will be a pleasure to contribute to fuel the enthusiasm for the simulation and for this magnificent engine-outerra!   :D :D

Bob425:
Thank you for your kind words, Andfly.

z & x are next to each other on the keyboard, so it is a easy mistake to make!

Navigation

[0] Message Index

[*] Previous page

Go to full version