Another N00B needs some halp plz

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

Another N00B needs some halp plz

Postby Metagami » Sun Apr 11, 2010 4:42 am

How would I go about making an OnCollide script where it slows down the sim speed?
User avatar
Metagami
 
Posts: 25
Joined: Sun Apr 11, 2010 4:36 am

Re: Another N00B needs some halp plz

Postby Metagami » Sun Apr 11, 2010 6:25 am

And another thing, how do I write a script that rotates the camera?
THX for your help guys
User avatar
Metagami
 
Posts: 25
Joined: Sun Apr 11, 2010 4:36 am

Re: Another N00B needs some halp plz

Postby sheepborg » Sun Apr 11, 2010 7:26 am

for camera rotation you really could do it mechanically, no need for scripting
you could do follow with camera and track rotation

might i ask what you would do with that?
BTC: 12wcLxBejr6rhCk6WPyVSNmkjwwbxXEvBG
LTC: LQ17UdL71xzLCprSfkoWUQXDXWuHjx2nf9
FTC: 6nfbPuFbtk8uNokYSsVfbzc5393ggxNGDC

polygons > textures

STUFFES:
http://www.algodoo.com/algobox/profile.php?id=4540
User avatar
sheepborg
 
Posts: 203
Joined: Sat Dec 05, 2009 10:44 pm
Location: North Carolina USA

Re: Another N00B needs some halp plz

Postby RicH » Sun Apr 11, 2010 1:41 pm

sim.timefactor is the variable that you want.
Millions of voices suddenly cried out in terror, and were suddenly silenced. Something terrible has happened.
User avatar
RicH
[Funniest Person 2010]
 
Posts: 2043
Joined: Tue Sep 01, 2009 9:01 am

Re: Another N00B needs some halp plz

Postby Metagami » Sun Apr 11, 2010 4:13 pm

Thanks for the first one, and I already have a ball on camera follow, so I can't have a turning ball on follow rotation also or else it won't fallow the ball.
I'm making a ball that activates slow-motion when it hits a ramp, and also tilts gravity(already have the script for that) and camera angle when it hits a wall.
Thanks for your help!
User avatar
Metagami
 
Posts: 25
Joined: Sun Apr 11, 2010 4:36 am

Re: Another N00B needs some halp plz

Postby Chronos » Sun Apr 11, 2010 4:33 pm

You could always put a box that has a weight on the bottom onto the circle, and make that box and weight invisible and unable to collide with anything. Then make the camera follow the box and track rotation. When the gravity switches, it'll turn the box (using the weight) and rotate the camera. :) I'll upload an example if you don't understand.
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: Another N00B needs some halp plz

Postby Dakta » Sun Apr 11, 2010 5:21 pm

Yes, but Chronos, that can only work so well.

I think he's trying to make something similar to a couple flash games I have seen. Here's the gist of gameplay:

You control a ball. You can move and maybe jump the sphere. When you are flying through the air, time slows down. When you hit a wall, gravity changes so that that wall is now the floor.

You navigate your way through puzzles and avoid obstacles. There might be enemies.

If you had a free swinging weight attached to the ball, it would not be as smooth as this guy needs it to be.


What you need to do is create a box or something, and make it's rotational velocity thing +inf. Then, attach your ball to that object with a hinge. This hinge controls movement, so make it a motor.

For slow motion through the air, you could either do it with colliders on the ramps, or with a collider on the ball. I suggest the latter. The collider on the ball should check and see if the ball is touching anything, and if it is set sim.timefactor to normal, and if not set it to less. This way, any time you are in the air time will slow down. And it is less work than adding colliders to all the ramps and stuff.

For wall collide gravity switch, you can either set a collide on the wall so every time something hits it gravity changes to whatever angle it is at (which won't work if you have rounded edges, like a large ball), or you could do some mechanical stuff on the ball that would track the angle of the "ground" under you and set camera rotation tracking and gravity tracking. This is the best option by far.

I'll see if I can mock it up. Hope that helps!
.. ,__,_____
. / __.==--" - - - - - - - - ""
./#(-'
.`-' From http://www.ascii-art.de/. Modded by me to work in Arial. Image
a Mammoth wrote:be boring and interesting.

Mystery wrote:If you were jailbreaker you shouldn't have when't up the 3.1.3
I didn't know you could go up 3.1.3! Thanks Mystery person!
User avatar
Dakta
 
Posts: 417
Joined: Sat Sep 12, 2009 4:36 pm

Re: Another N00B needs some halp plz

Postby Metagami » Sun Apr 11, 2010 5:58 pm

Okay, the slow-motion and gravity switch work great, and it turns out I don't need any of that fancy stuff.
I was looking at a normal script page; I noticed all camera scripts start with scene.camera. and the gravity is rotated by increments of pi, so for the upside-down plane, I tried:
Code: Select all
(e)=>{scene.camera.rotation = 3.14159 }
It surprisingly worked! In return for giving me the timeFactor script, I give you the camera.rotation script!
Thanks for all the help anyways!
User avatar
Metagami
 
Posts: 25
Joined: Sun Apr 11, 2010 4:36 am


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 3 guests