Archive 17/01/2023.

Methods to parent objects to characters

fnadalt

Hi! I need some help to implement scene objects “grabbing” by my character. Some scene props tagged as “items” should be held by hand. Items have RigidBody. Items are grabbed by pressing CTRL when colliding against them.
The first apprach I used was reparenting the item to the “hand” node and disabling its RigidBody. I has this issue when “dropping” it: Physics issue when reparenting node.
The second approach was to disable physics at grabbing and re-enabling it when “dropping”. Grabbed object transform is updated according to the hand node at FixedUpdate.
Neither of them performs well over network, being the item REPLICATED.
Any ideas?

https://github.com/fnadalt/World/blob/master/bin/Data/Scripts/Person.as.

Modanung

Have you tried using RigidBody::SetKinematic(true) instead of disabling the rigid body?

Sinoid

Can you explain how so? Things run slow or latency chokes it or what?


Create a kinematic body (flagged to be nonreactive to most everything in the scene) on the hand and point-constraint linking the hand and the object. When dropping, remove the constraint. Switch flags on your object as necessary.

Only suitable for short-term carry (constraints don’t make sense for long-term carry, heavy), and if network latency is the problem then that’s not going to be any better.