Hey, I’m making a drag-able door, (it will be used for VR later, but not right now). for now, for simplicity and ease of testing sake, I just attached a sphere to my character as an interactor, that will be switched to the motion controllers later.
so I stripped the blueprints from Mitch’s VR lab sample, packed most of it into the door blueprint and managed to get it working, now I want to add some bouncing functionality, but I can’t figure it out. Currently the door stops when it’s in closed position, but it also stops after it hits the maximum open angle, what isn’t very natural. I wanted to make it bounce back after hitting the max angle, as if it hit a wall or something. here’s the code on my door blueprint:
(right click > open image in new tab for full size)
event tick calls for the IsDragging flag which is set on by pushing the grab button and off by releasing it. then while dragging, it sets the door’s rotation relative to my interactor, and after releasing the drag button, it checks for some stuff to see if the door should stop or keep going, and if it should keep going, it sets the rotation movement according to some physics simulation math.
so one of the things that flags the door movement should stop is if it is equal or higher the maximum door yaw. I detached this boolean but I didn’t work, it broke the door and as soon as it hit max yaw, it would return to closed position or something.
then I tried setting the initial yaw speed to negative of what it was the moment it reached max yaw, but didn’t work also. then I tried setting initial yaw angle to reverse the current angle after hitting max yaw, no game.
I also tried using a physics constraint, but it completely broke the code, and I couldn’t even figure out where to start debugging it so scrapped that idea too.