Slow Motion

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

Slow Motion

Postby roffa » Sat Jul 17, 2010 4:17 pm

What I want is a slow motion thyme that use 1 second to change from one state to another, but I don't know how to make it.

I know how to make the slow motion:
Code: Select all
(e)=>{
    sim.frequency = 1000;
    sim.timeFactor = 0.1
}

But I don't know how to make it so it take 1 second (or another value) to change from one state to another.


Here is a scene where I have used the slow motion thyme:
Rating: rated 5.6
Filesize: 70.14 kB
Comments: 4
Ratings: 2
download



Please help!
User avatar
roffa
 
Posts: 92
Joined: Thu Mar 18, 2010 4:58 pm
Location: Norway

Re: Slow Motion

Postby Kilinich » Sat Jul 17, 2010 5:36 pm

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: Slow Motion

Postby roffa » Sat Jul 17, 2010 6:15 pm

I don't realy understand your events system, sorry...

+ Your events system look like it has instant changes, not gradually changes.
User avatar
roffa
 
Posts: 92
Joined: Thu Mar 18, 2010 4:58 pm
Location: Norway

Re: Slow Motion

Postby Kilinich » Sat Jul 17, 2010 8:59 pm

Ok, what you want?
a) slow down 10 times for a one second (will take 10 secs in real time)
or
b) smoothly change time scale from 1 to 0.1 within 1 sec of realtime
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: Slow Motion

Postby Chronos » Sat Jul 17, 2010 9:20 pm

From the looks of it, I think he wants B.
TheWinkits wrote:They both looks of cuking amazing
User avatar
Chronos
[Most Active Member 2010]
 
Posts: 4457
Joined: Mon Aug 31, 2009 6:00 pm
Location: Californania

Re: Slow Motion

Postby roffa » Sat Jul 17, 2010 9:28 pm

I wan't B.
User avatar
roffa
 
Posts: 92
Joined: Thu Mar 18, 2010 4:58 pm
Location: Norway

Re: Slow Motion

Postby roffa » Tue Jul 20, 2010 2:40 pm

Can't someone just say the code.
User avatar
roffa
 
Posts: 92
Joined: Thu Mar 18, 2010 4:58 pm
Location: Norway

Re: Slow Motion

Postby Rideg » Tue Jul 20, 2010 10:17 pm

I don't know if this is what you wanted but I'll post it anyway. (onHitByLaser)

Code: Select all
(e)=>{
    {sim.time - e.geom.controllerAcc >= 0.01 && sim.timeFactor >= 0.1} ? {
        sim.frequency = sim.frequency + 10;
        sim.timeFactor = sim.timeFactor - 0.01;
        e.geom.controllerAcc = sim.time
    } : {}
}


Remember to set the controllerAcc to 0.0. :thumbup:
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: Slow Motion

Postby roffa » Tue Jul 20, 2010 10:44 pm

That is about what I want. But when the laser hit something I don't only want the simulation speed to go down gradually. I want it to go down to a specific value, and then stop slowing down the time.

Your script does make it so that it go down gradually, but it only slow down the speed when the laser is hitting an objekt, and stops slowing down the speed when the laser don't hit anything. Your script doesn't make the simulation speed to stop on a specific value either.
User avatar
roffa
 
Posts: 92
Joined: Thu Mar 18, 2010 4:58 pm
Location: Norway

Re: Slow Motion

Postby Rideg » Tue Jul 20, 2010 10:49 pm

yes it does. when the sim.timeFactor is less than 0.1 it wont slow it down.
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: Slow Motion

Postby roffa » Wed Jul 21, 2010 3:18 am

Oh, you're right. Sorry :oops:


But then this might be usefull, thanks :)
User avatar
roffa
 
Posts: 92
Joined: Thu Mar 18, 2010 4:58 pm
Location: Norway

Re: Slow Motion

Postby Rideg » Wed Jul 21, 2010 4:33 pm

Anytime! you can make it go faster by raising the addons to the frequency. ;)
Image
make sure to check out my work.
User avatar
Rideg
 
Posts: 948
Joined: Tue Dec 15, 2009 5:17 pm
Location: Östersund, Sweden


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 5 guests