Thruster script issue

If you have problems installing or running Algodoo, have found a bug or need in-game help - this is it!

Thruster script issue

Postby lancelot » Wed Jun 12, 2013 12:32 am

This is on v2.0.2b15. You might not want to try this as it pollutes the ROOT namespace. If I evaluate the following:

Code: Select all
Scene.Clear;
Scene.addPlane({pos=[0,0];angle=.5*math.pi});
Scene.addPlane({pos=[-5,0]});
Scene.addPlane({pos=[5,0];angle=math.pi});
Scene.addCircle({pos=[0,.5];radius=.5;geomID=1});
Scene.my.thr=Scene.addThruster({geom=1;relPoint=[-.25,0];size=.5;followGeometry=false;
  _dir=0;_t0=Sim.time});
Scene.my.thr.rotation={
  v=(readable(entity)).geom;
  v=(Scene.entityByGeomID(v)).vel;
  v(0)^2+v(1)^2>.01||Sim.time-_t0<1?{}:{
    _dir=math.pi-_dir;
    _t0=Sim.time};
  _dir}


and run the simulation, the rotation value isn't updated properly and _dir is always 0. If I go to the script menu for the thruster and just press Enter in the rotation field, after that the simulation runs as expected and _dir changes from 0 to pi.

If I try to set the rotation (to the same script) in the addThruster call, that doesn't work either.

Now if I run the simulation and then click Undo, I get some errors and the thruster properties become visible in the ROOT namespace, so evaluating force in the console gives 5, etc.

Also, I cannot just do Scene.entityByGeomID(1) to refer to the circle with geomID=1, but I think that's a known issue.
lancelot
 
Posts: 5
Joined: Wed May 29, 2013 3:17 am

Return to Help / Bug reports

Who is online

Users browsing this forum: No registered users and 2 guests

cron