I’m currently making a game where the player can pickup/throw/interact with various objects.
However unlike the VR template which uses AttachToComponent, i need the grabbed object to keep simulating physics so the user is unable to push/clip items through other objects.
To do this i’m making use of the Physics Handle component. (Grab component at location & rotation) This works great as it behaves more like a configurable spring rather than a position/rotation override. Currently position wise the blueprint works great, rotation wise… not so much.
The problem i’m having however is that i need the object to maintain it’s rotation relative to the controller from the moment it’s picked up. This so you can pick up a bowl and pour its (physics simulated) content out for instance.
The issue i’m having however is that i can’t get a usable rotation target coordinate to send to the grabbed object each tick.
Currently i save both the world rotation of the MotionControllerComponent as the grabbed object the moment a grab is initiated, i stored these in the two rotation variables visible in the image.
The goal is now to get the objects to maintain their proper (rotational/positional) offset while grabbed.
The farthest i come is where the object seemed to rotate properly over some axis though span in wrong directions over some other axis.
I don’t understand there why you would need to make use of combine rotators twice. Theoretically you just have your motion controller rotation and then you have something like offset rotation of your grabbed object. So on the start of the grab you would set that “offset rotation variable” = Object world rotation - (Delta Rotator) Motion controller rotation. In event tick you do then do Motion controller rotation + (Combine Rotators) “offset rotation variable” in set target rotation.
yeah the problem was that for some reasons the rotational axis were looking like some of them were swapped and/or inverted, so that’s figuring out 1 out of 512 permutations.
Currently sidestepped the entire problem by rotating a scene component (parented to the controller) to 0,0,0 in worldspace the moment before a grab was initiated, and then feeding the worldspace rotation it picked up into the rotation of the grabbed object on top of it’s initial worldspace rotation in the world.
Just trying to get this working in my own project. It is very odd, I did not have this problem before 4.13. The only thing I can get working without the rotations going in the wrong directions is with setting a child component to the 000 world rotation before the grab and then simple feeding its world rotation in Set Rotation but then it rotates it off on the start of the grab. What exactly do you mean with "feeding the worldspace rotation it picked up into the rotation of the grabbed object on top of it’s initial worldspace rotation in the world. "?
I’m executing this the moment a grab is initiated
The position input is where the linetrace hitting the selected object.
“L_Rot_Object” is saved in a variable, this is the wordspace rotation of the object that’s being grabbed, this is also fed into the initial target of the “grab object” node
i’m using the “L Rot Offset Arrow” (an object parented to the motion controller) to store a 0,0,0 worldspace rotation during the grab and then using the deviation from that to rotate the physics object.