#How can I parent a gun entity's transform to the hand bone of my player?

1 messages · Page 1 of 1 (latest)

weary kelp
#

There are a Gun Entity (which instantiated the Gun GameObject) and a PlayerEntity (Instantiated the Player GameObject) in my scene. The Player GameObject contains a rig with a hand bone.

Tried adding the Parent Data to the Gun Entity, but it doesn't allow me to specify which part of the entity I want it to parent to:
state.EntityManager.AddComponentData(entity, new Parent() { Value = playerEntity });

Am I supposed to create an entity for my hand bone to make this work?notlikethis
Feels like this is a stupid question but I am stuck here for hours now, so any help is welcomed!!

bleak lake
#

but gotta admit, this is pretty ugly

#

and if your gun is game object too

#

I'd consider just parenting it only via game object

#

while entity responsible for gun would be without any transform

weary kelp
#

Removing the Transform component if the gun is parented sounds like nice solution🤔 Will try that out, thanks!!

bleak lake
weary kelp
#

Yes, there are guns lying in the world and the player can pick them up

bleak lake
#

removing component is ugly, but I can't think of anything cleaner tbf