So essentially I’ve got a game where you have to reflect a ray of light using mirrors (dynamic lighting). To do that, you pick up ‘F’ mirrors and rotate them on different axis (X & Z). When done and the mirror is in the right position, you drop the object ‘F’. The problem is, because I can tilt back the mirrors for example (they’re cubes), as soon as I drop the object they flip, as affected by gravity - so they fall over.
I have ‘Pickup object’ and ‘Drop obj’ as custom events, so I’ve enabled ‘Simulate physics’ when picked up and disabled upon dropping the mirror, which does it - freezes the mirror cube in place as it’s not affected by physics anymore.
Problem is, when I pick up another mirror object, physics apply to the previous one again - because the enable / disable simulate physics is all done under the linetrace node inside the character blueprint. Which means I am enabling and disabling the physics of an object only for as long as linetrace triggers a hit event. //Grab mirror #1 → the hit object is mirror #1 → rotate it, drop it → object #1 frozen in place, physics disabled, all good. Grab object #2 → hit object is now mirror #2 => Object #1 is no longer the hit object, so physics are re-enabled, object belly flops.
So I’ve created 2 more custom events - ‘Enable physics’ and ‘Disable physics’ in the mirror’s blueprint in hope it will directly affect the objects’ physics. When picked up, it calls ‘Enable physics’ from within the objects’ bp. Same when dropped, disabling physics.
Now, I obviously needed an object reference ‘Reflector’ that references the mirror object when the event calls in the Player blueprint. Thing is I have absolutely no idea how to set that variable and where.
And to be fair, any kind of solution would do, no matter if different - I just want to grab a mirror /10, adjust it, drop it and it stays in that position. Grab mirror #2, mirror #1 still frozen in place. And so on and so forth. Axis constraints maybe? but that wouldn’t allow me to rotate the objects.
Any help would be greatly appreciated. Thanks!
(I am sorry for the spaghetti code.)