Page 1 of 1

Change the color of an object when two other objects collide

PostPosted: Mon Aug 17, 2020 6:54 pm
by lsnook
I change a variable state when two objects collide.
scene.my.variable=0
on_collison between object 1 and 2; scene.my.variable changes to 1.
When this happens, I want the color of a 3rd object to change.

Re: Change the color of an object when two other objects collide

PostPosted: Mon Aug 17, 2020 7:57 pm
by lsnook
Or, if there is another way to do this without using variables, that is fine too.

Re: Change the color of an object when two other objects collide

PostPosted: Tue Sep 01, 2020 3:55 pm
by DabTheDabr
lsnook wrote:I change a variable state when two objects collide.
scene.my.variable=0
on_collison between object 1 and 2; scene.my.variable changes to 1.
When this happens, I want the color of a 3rd object to change.

Good question :thumbup:

You can have the variable change in postStep.
It would look like this:
postStep:
Code: Select all
(e)=>{
scene.my.variable == 1 ? color = whateverYourColorIs : color = originalColor
}

Note that whateverYourColorIs and originalColor are not supposed to be in the code, and are meant to be substituted with your value of choice (in this instance, an array). Such is the nature of pseudocode.