Rotating a texture using scripts

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

Rotating a texture using scripts

Postby Rideg » Tue Oct 05, 2010 9:09 pm

Hello. I've made a texture wich I need to rotate when the circle that holds the texture is hit by a laser.

Does anyone know how I would go around making this happen? :angel:

Thanks ;)
Image
make sure to check out my work.
User avatar
Rideg
 
Posts: 948
Joined: Tue Dec 15, 2009 5:17 pm
Location: Östersund, Sweden

Re: Rotating a texture using scripts

Postby Nait » Wed Oct 06, 2010 4:54 am

You should search better....
Kilinich wrote:Repost from phun forum to algodoo.
Some of my "knowhow" thyme functions:

1) For dynamic textures (rotation/scaling ):
Code: Select all
//T - original textureMatrix, T(2) and T(5) - horizontal and vertical shift
//a - rotation angle
//s - scale
scene.my.txTransform := (T, a, s) => {[math.cos(a)*s, math.sin(a)*s, T(2), - math.sin(a)*s, math.cos(a)*s, T(5), T(6), T(7), T(8)]};

//Type it in console to make test:
scene.addbox{color := [1,1,1,1]; texture := "algoryx.png"; textureMatrix := {scene.my.txTransform([1,0,1,0,1,1,0,0,1], app.mousepos(0), 2^app.mousepos(1))}}

viewtopic.php?f=13&t=1032&p=10228&hilit=repost#p10228
User avatar
Nait
 
Posts: 224
Joined: Fri Oct 30, 2009 1:56 am
Location: Eastern Russia, Vladivostok


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 5 guests