Algodoo portal 2

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

Algodoo portal 2

Postby Kilinich » Tue Dec 11, 2012 10:00 pm

I'm personally thought it's impossible... but, few test, and wow! It works!

Rating: rated 7.7
Filesize: 38.18 kB
Comments: 12
Ratings: 10
download


Interesting code here:

Code: Select all
// Portals positions and angles
Scene.my.portalPos := [[[0, -3], 1.5707964], [[-3, 0], 0]];
// Transform pos, vel, angle of object through portal 0 or 1 (blue or orange)
Scene.my.teleTrans := (pos, vel, angle, tele)=>{
    da := (scene.my.portalPos(1 - tele)(1) - scene.my.portalPos(tele)(1));
    [scene.my.portalPos(1 - tele)(0) + scene.my.rot(pos - scene.my.portalPos(tele)(0), da)] ++ [scene.my.rot(vel, da)] ++ [angle - da]
};
// Rotate vector
Scene.my.rot := (v, a)=>{cos_a := math.cos(a); sin_a := math.sin(a); [v(0) * cos_a + v(1) * sin_a, v(1) * cos_a - v(0) * sin_a]};


The rest is in the boxes and circles, there are 3 copy of each.
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: Algodoo portal 2

Postby guyboy » Wed Dec 12, 2012 12:30 am

Very nice. Is is possible to make one that works with all objects? even new ones that have no code?
ImageImage
Human horse pasture expansion OpenGL Book Hall
Kwon owned Version (C) 2002-2008
User avatar
guyboy
 
Posts: 80
Joined: Mon Aug 31, 2009 6:19 pm
Location: Ḻ̘̬͕͍͚̥͈͚͖̝̜̲͕̭̩ͅ

Re: Algodoo portal 2

Postby Kilinich » Wed Dec 12, 2012 7:43 am

Everything possible =) but not in that scene.
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: Algodoo portal 2

Postby BlockJuice » Mon Jul 29, 2013 9:31 pm

Decided to make a follow-up to this.
Rating: rated 5
Filesize: 5.44 kB
Comments: 0
Ratings: 1
download
BlockJuice
 
Posts: 4
Joined: Mon Jul 22, 2013 1:49 am


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 4 guests