Every step and location

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

Every step and location

Postby dsengere » Sun Jan 17, 2010 12:38 am

Hi there. I'm wondering, are there ways to:

1: Have a "step" event, so that literally every frame of Algodoo running, an action can be commited (or an event checked?) In other words, a way to "always" be checking for whatever input?

2: Track an object's location (x,y,z)? I need to be able to use an object's location as a variable for other objects to use as inputs for whatever value, (density, length, etc.)

Thanks!
dsengere
 
Posts: 12
Joined: Thu Oct 22, 2009 5:49 pm

Re: Every step and location

Postby standardtoaster » Sun Jan 17, 2010 12:44 am

You would need to use a beacon. Follow the tutorial and it will turn out great. :)

To constantly get the location of an object you would need add a beacon near the center of the object and in the onCollide write:
Code: Select all
Scene.my.pos = e.pos

e.pos(0) = X axis
e.pos(1) = Y axis
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: Every step and location

Postby dsengere » Sun Jan 17, 2010 2:07 am

I'm sorry but I'm having some major problems. Does the beacon include the circle, or is the circle that you had in your beacon post the actual object where I put the "step" text? BTW I really hate this stupid coding method.

Thanks for your help
dsengere
 
Posts: 12
Joined: Thu Oct 22, 2009 5:49 pm

Re: Every step and location

Postby standardtoaster » Sun Jan 17, 2010 3:09 am

Yes, the circle is the easiest place to put the script. What don't you like about the coding method?
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: Every step and location

Postby dsengere » Sun Jan 17, 2010 4:01 am

Ahhhh. Thank you very much. My only problem now is that scene.my.pos(0) and scene.my.pos(1) aren't updating. Do you know how to fix this?

By the way thanks so much for your time. You are quite helpful.
dsengere
 
Posts: 12
Joined: Thu Oct 22, 2009 5:49 pm

Re: Every step and location

Postby standardtoaster » Sun Jan 17, 2010 4:28 am

Did you put Scene.my.pos = e.pos in the script? Also, are you using Algodoo or Phun? In both applications a beacon is the fastest updater possible. In Algodoo you could just point the laser where you want and use Scene.my.pos = e.pos instead of a beacon.
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: Every step and location

Postby dsengere » Sun Jan 17, 2010 4:50 am

Alright. I'm using Algodoo. In the most "algodoo-for-dummies" method possible, can you explain to me the steps of how to use a laser to extract an object's (a rolling ball) X and Y coordinates and turn them into variables which I can have an object draw?

Thank you sir.
dsengere
 
Posts: 12
Joined: Thu Oct 22, 2009 5:49 pm

Re: Every step and location

Postby dsengere » Sun Jan 17, 2010 4:52 am

Never mind, I got it. Thanks dude!
dsengere
 
Posts: 12
Joined: Thu Oct 22, 2009 5:49 pm

Re: Every step and location

Postby standardtoaster » Sun Jan 17, 2010 4:57 am

You're welcome! :D I love it when people find out the answers to things immediately.
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 11 guests