The component Physics Handle is hardly use able in its current state:
Set Target Rotation doesn’t seem to do anything, the grabbed component will always spin around no matter what you do. When you try to force it to rotate with the player the result will be that it will fly away while rotating the view.
Set Target Location works badly, when you rotate your view around quickly your grabbed component will drag behind and that even happens when you have linear stiffness and interpolation set to huge values. The worst part is that it can get stuck somewhere while it gets dragged behind.
I created a tutorial on how to setup physics handles here. There is also a forum thread discussing them.
I haven’t tried this setup in 4.8 myself but I have had other users report that it works fine in 4.8 and 4.9. Could you look through it to see if that setup works for you?
If it doesn’t, could you include some screenshots of your setup or a small test project?
Yea, I used that tutorial, In your video you can see the problems as well. It spins around and lags behind. It appears physics handle only attaches position and not rotation thats why it look like it spins when the player rotates differently. For what I wanted to do there I fell back to a Physics constraint instead and to keep it from being pushed through collisions I made it break off when there is too much stress through collision. Far from optimal gameplay wise but at least it works and it is always in the hands of the player.
But I run already in another case where I need this to work. I basically have a physics ball and on that I want to attach a ragdoll, without the ragdoll changing the mass and velocity of the physics ball. Physics constraint will change the mass and velocity and physics handle will not attach it rotation wise and the position lags behind. It seems there is no actual way to do this?
Just so I can get a better understanding. Could you post a short video or gif of an example of exactly what you are trying to accomplish? A clip from an existing game or anything like that would be fine.
For the first case I had which I have given up on to solve it with a physics handle I can give you several videos. This is pretty much the first version of grabbing something by using a Physics constraint (Problem: it has too detach when it has too much stress to prevent it from getting pushed through collisions)
As you can see the box is 100% on the hand position and 100% on the hand rotation at all time. Now with a physics handle it lags behind, so the faster you drag it around the more further away it is from the hands (the target location). But the even bigger problem is that it doesn’t get the rotation of the hands at all. (the target rotation)
Setting target rotation doesn’t work and setting a high interpolation location speed doesn’t work either, it appears to be clamped at 100.
The reason I need a Physics handle now is that you can not move a physic handle grabbed object through a collision and that you can grab any bone of a skeleton. (Using a physics constraint on a bone doesn’t work, only the root works)
To keep the box from rotating you can set the Constrain Rotation on the Grab Component node to true. However Physics Handles will always have some lag because the object is still simulating physics and has mass.
To accomplish what you want, I suggest maybe going about it another way.
You could try this: Hit trace the Physics Object > Set it to the location in front of the player where you want > Turn Simulate Physics off > Attach it to a socket to carry it around
Then when you drop it > Detach the object > Simulate Physics on > Wake Rigid Bodies
Using that method you should get something that is very similar to the video you posted.
But with that solution the object would move freely through every collision. Weld attaching a collision to a player collision doesn’t work either. I’m pretty sure constraining the rotation would make the rotation be locked in world space. But it would still need to get rotated to how the hands are rotated which would then not work at all anymore.
Using the method I mentioned you would need to adjust the characters movement and rotation based on if the box is colliding with a wall or any other collision object. Or detach and simulate/wake the object so it pops loose on collision, like in the video above.
If you want to keep the physics handle approach, you could also try playing around with Substepping. It’s an experimental feature but it basically allows physics to look smoother and be updated faster. It can be performance heavy though.
I also want to set the physics handle rotation with the player ,but failed. Have you found solution now? if you have implement the function, can you tell me the method.Thank you .
No, I just went with Physics Constraint instead again and did that as best as I could. It then detaches when there is too much stress on it to prevent it from going through collisions.
As the OP was pointing out, if you disable physics to attach the object to a component or socket, the object will not collide with other actors in the world. What we need is the ability to attach the physics handle to a scene component or a socket so that we can more easily manipulate it (by rotating the scene component for example). Otherwise you can pick up objects, but you can’t rotate them etc.
Is there some reason why the Physics Handle is added in underneath the character movement as opposed to the component tree like everything else?