How can Add force on a child gameobject having Rigidbody in parent gameObject?
I have a Player Gameobject on which i have a Rigidbody with help of which i am moving it ! I have a hand gameObject in its child and i want to press a key to add Torque force on that game object ! I tried to add Rigidbody to hand to but the whole gameoject started to go through to colliders due to Gravity of Parent GameObject and some other weired motions were accorring
Answer by tormentoarmagedoom · May 14, 2019 at 03:27 PM
Hello.
As far as I know, and as Manual says:
"Force can be applied only to an active Rigidbody"
So if no rigidbody, no forces can be applied.
The question i make to you is, why want to add force? what you pretend to do? why not simple change its transform with a corutine?
Bye!
@tormentoarmagedoom I want my Player to punch enemy with hand so without adding force on Hand how can player punch the opponent !
Then "simulate the impact".
$$anonymous$$ove the hand with transform.localposition
The hand must have a trigger collider.
The enemy must have a collider and rigidbody.
Detect the collision from a script attached to the hand or in each enemy using OnTriggerEnter()
When trigger collision is detected, apply the force directly to enemy rigidbidy by code.
Bye! :D
Your answer
![](https://koobas.hobune.stream/wayback/20220612201348im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Figuring out what the acceleration will be before applying force to RigidBody2D 0 Answers
Space,Gravity,RigidBody,Physics Forces 0 Answers
Set predicate dice value when rolling 0 Answers
What's the best method for pinball-type bumper physics (3D)? 1 Answer
Getting two Objects to the same direction with different speed 0 Answers