Hi, I’m trying to make it so I can drag items along the plane the camera is facing in the game world using mouse position, but I can’t figure it out, can anyone help please?
So far I have a widget created that On Mouse Move gets the difference between the mouse’s current Screen Space Position, and the Last Screen Space Position, and want to use the Vector 2D variable calculated and add it to the grabbed actors current location, but at the correct angle to move it along the plane.
I hope I’m making sense, if not I can try to explain a bit more
do not use Set Actor Location for this - look into PhysicsHandle Component
the physics will not act right out of the box, on the contrary - it’ll be the very opposite of Zen
– increase tensor scale, angular dampening and play with mass
– crank up position & velocity solvers, maybe even enable CCD
– look into physical materials, especially restitution
– depenetration is another element - it controls how rapidly objects get ejected when their geometries intersect. Start around 100 and see how it behaves, adjust.
Tweaking will be required.
There might be a reasonable alternative to this using constraints.
make a ‘find look at rotation’ from the object to the camera. This will give you an FRotator (orientation info). then you:
-Create a 'Scene object '(null transform object) in the objects position
-Set the world rotation of that ‘scene object’ with the rotator so this scene object has the right orientation regarding the camera.
-parent you original object to this scene object
-move the ‘scene object’ LOCALLY (add local offset) in the right local axes depending on your mouse movement.
-when you release the mouse you can unparent and reparent were needs, also unparent with keep world on transforms.