Change the color of an object when two other objects collide
3 posts • Page 1 of 1
Change the color of an object when two other objects collide
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.
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.
- lsnook
- Posts: 3
- Joined: Wed Aug 12, 2020 9:35 pm
Re: Change the color of an object when two other objects collide
Or, if there is another way to do this without using variables, that is fine too.
- lsnook
- Posts: 3
- Joined: Wed Aug 12, 2020 9:35 pm
Re: Change the color of an object when two other objects collide
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
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.
-
DabTheDabr - Posts: 5
- Joined: Tue Aug 25, 2020 7:36 pm
- Location: United States of America
3 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest