more precision

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

more precision

Postby hiltropper » Sat Nov 26, 2011 5:41 pm

hi there
i wrote a short script which should hold a geom with a thruster on one y level no matter which angle the thruster has, so when the geom rotates the direction of the force changes and to hold the y level there must be more force, you know what i mean ? my script looks like that
Code: Select all
(e)=>{
    scene.my.angle = (math.atan(e.normal(0) / e.normal(1)));
    scene.my.downforce = sim.gravityStrength * scene.my.allmass;
    scene.my.force = (((math.tan(scene.my.angle) * scene.my.downforce) ^ 2) + (scene.my.downforce ^ 2)) ^ 0.50000000
}

scene.my.allmass is the mass of all the objects in which centre the thruster is fixated

it almost works , but the object does not stay perfect on one y level , it slowly drifts up when air is activated or down when air is turned off. could this has to do with rounding errors or something like that ?

[EDIT] and when the angle is exactly 90 ° it does not even stay on one x level it makes silly left/right moves is there anything wrong with the thrusters ? i'm using beta 9b
[EDIT2] ignore the first edit it was not that exactly 90° so everything okay about that
yup yup
yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
hiltropper
 
Posts: 85
Joined: Mon Dec 20, 2010 12:02 pm
Location: Germany

Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 5 guests