Object Spawning Help (with materialName)

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

Object Spawning Help (with materialName)

Postby HumanoidX » Tue Dec 29, 2020 3:43 pm

A friend of mine is making something. Maybe a Marble Race.
Now he had set an object's materialName to, let's say, "foo".
He wants to add an object like, "spawn the 'foo' here when another object hit me".
Is there a possible way to do that?
I mean spawn the foo, the spawned object must depend on foo and not hardcoded.
Thanks a lot to those who even bother seeing this post!
Expecially those Thyme experts!
onCollide:
(e)=>{
System.exit;
}
HumanoidX
 
Posts: 3
Joined: Tue Jun 23, 2020 10:39 am

Re: Object Spawning Help (with materialName)

Postby FRA32 » Sat Jan 30, 2021 12:15 am

inside your sample object, put this in poststep:

(e)=>{
scene.my.sampleObject=entity
}

then, in your trigger(oncollide or whatever) you use this line

newObj=scene.cloneEntityTo(scene.my.sampleObject,[SOMEPOSITIONHERE])

after that you can edit the properties of the newly summoned object by editting the properties of newObj, for example:

newObj.color=[1,1,1,1]
FRA32
 
Posts: 229
Joined: Wed Dec 03, 2014 9:51 pm


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 4 guests