Entity-id

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

Entity-id

Postby stephane.savanah » Tue Mar 04, 2014 1:14 pm

How can I use entity-id to affect a remote geometry?
For example: I want to change the force on a thruster using a script from a geometry or in the console. I know one can use 'this' and 'other' in OnCollide to affect another object, but it only affects the two objects in the collision. why can't I do something like this:
onCollide e=>{scene.1234.color={1.0,1.0,1.0,1.0]}
i.e. on collision of an object a specific other object with entity-id=1234 changes colour to white.
Of course this script does not work - but how would I achieve this?
stephane.savanah
 
Posts: 11
Joined: Tue Feb 11, 2014 8:20 am

Re: Entity-id

Postby Kilinich » Tue Mar 04, 2014 4:49 pm

You could do it for some entities.
For example in onSpawn of thruster put onSpawn=(e)=>{scene.my.thrusterID = e.this.entityId} and in onCollide of some geom put onCillode = (e) => {(scene.entityById(scene.my.thrusterId)).force = 10}
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: Entity-id

Postby stephane.savanah » Wed Mar 05, 2014 6:24 am

Excellent! Thank you...
stephane.savanah
 
Posts: 11
Joined: Tue Feb 11, 2014 8:20 am


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 6 guests