AnswerStackCategory: Loops (Fastloops/ForEach)Scoping same two collided objects of same type
AvatarDylan Dexter asked 3 months ago

If I have two objects of the same type or qualifier tested for collision, then how do you access both collided objects individually.
This seems simples with two different object types, but causes some difficulty scoping two of the same type?

AvatarDylan Dexter replied 3 months ago

To be more clear, – when two objects of the same type collide with each other, – how do you access them independently?

1 Answers
AvatarDylan Dexter answered 2 months ago

Ok, have managed to work out that I can use a collision flag in the objects to help scope both collided objects, ie.-
1) Test for Object collides with same object type, –
Collision detected, then Set Object collision Flag to True – This seems to set the flag to True for both collided objects.
2) Fast loop through all the objects,-
Scope the object using ‘On loop’ & object ID = loop Index, & Object Collision Flag = True.
Then once this condition is met, store the object reference in a variable or list object for later reference.
3) Access either of the two collided objects by scoping the object type and comparing the loop index with object ID,
and comparing the objects reference value value with stored object reference.
Once scoped you should have access relevant object.
At the end, set the Collision Flag to False and repeat process.

Close Menu
Don`t copy text!

SALE NOW ON off Pro Membership!

Days
Hours
Minutes
Seconds
ClickFusion Academy Logo

Cookies

The ClickFusion.Academy website uses cookies to enhance user-experience and store information about how you use the site, login information and more. You can review our privacy policy here. By continuing to use the website, you agree to our privacy policy and terms and conditions.