force scripting

About advanced scenes, and the Thyme scripting language used in Algodoo.

force scripting

Postby chris1983 » Thu Aug 27, 2020 1:36 am

the circle rotates around the center of mass and moves to the right (i think that this is called rolling). Is it possible for the force to stay pinned at the relpoint(1) while follows the circle at the x-axis?


here's a video with what i want.
https://streamable.com/9fc02z
But this is not a desirable way. two circles(one rotates and one moves to the right), two thrusters (the one that rotates is invisible), 2 layers

i had some ideas, but no luck.

1.update at the thruster:
Code: Select all
rp = (readable(entity)).relpoint;
pos = [scene.my.circle.pos(0) , rp(1)]


2. at the thruster:
timetolive := 0.016666668
and ondie:
Code: Select all
timeToLive = 0.016666668;
    Scene.cloneEntityTo(e.this, Pos)


3. at thruster again timetolive := 0.016666668
and in poststep:
Code: Select all
scene.my.xfor(0, 50, Scene.addThruster {
    geom := -1;
    pos := [-0.24451852, 0.50514579];
    followGeometry := true;
    opaqueBorders := true;
    rotation := 0.00000000;
    force := 3.0000000;
    size := 0.25000000;
    colorHSVA := [135, 0.00000000, 1.0000000, 1.0000000];
    onKey := (e)=>{};
    update := (e)=>{};
    postStep := (e)=>{};
    timeToLive := 0.016666668;
    entityID := 4871;
    resources := [];
    color := [1.0000000, 1.0000000, 1.0000000, 1.0000000];
    onSpawn := (e)=>{};
    zDepth := 6.0000000;
    onDie := (e)=>{};
    onClick := (e)=>{};
    layer := 0
})




ps: the first seems better
give a man a fish and you feed him for a day; teach a man to fish and you feed him for a lifetime
User avatar
chris1983
 
Posts: 6
Joined: Thu Oct 04, 2018 7:51 am

Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 3 guests

cron