Box-Wing

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

Box-Wing

Postby Kilinich » Fri Nov 30, 2012 5:29 pm

Now simplest wing ever:

for box:
Code: Select all
_airForceMult := 0.05;
airFrictionMult = { v := entity.vel;
    n := [ - math.sin(entity.angle), math.cos(entity.angle)];
    vn := ((v(0) * n(0) + v(1) * n(1)));
    entity.vel = entity.vel - n * vn * entity._airForceMult;
    0}


Rating: rated 6.5
Filesize: 9.23 kB
Comments: 10
Ratings: 4
download
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: Box-Wing

Postby Kilinich » Fri Nov 30, 2012 5:52 pm

and for airplanes is more realistic code with quadratic force part:

Code: Select all
_airForceMult := 0.1;
_airForceMult2 := 0.01;
airFrictionMult = {v := entity.vel;
    n := [ - math.sin(entity.angle), math.cos(entity.angle)];
    vn := ((v(0) * n(0) + v(1) * n(1)));
    v1 := n * vn * entity._airForceMult;
    v2 := n * vn * vn * entity._airForceMult2;
    entity.vel = entity.vel - v1 - (vn > 0 ? v2 :  - v2);
    0
}
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 19 guests