Best approach for pendulum to inherit motion from parent GameObject

Hi all,

In my 2D game, i have a character with child objects that have been set up as a pendulum using a configurable joint.
the pendulum is working beautifully except for one small detail which is as follows:

when i move my character forward using it’s character controller i would like to see some small movement in the pendulum in the opposite direction… also when the player jumps/lands/collides i would like to see this reflected in the pendulum’s movement. Currently however, this is not the case…

I have been doing some research on this and have not come across a straight forward answer. Before i reinvent the wheel and begin scripting a complex solution i was hoping to get some advice on the most straightforward approach to this…

No need to write the script, i am just looking to better understand why this is happening and what i can do about it…

I have tried removing the parent/child relationship with the pendulum and the character but this did not seem to help, i’ve also tried modifying the parent’s.velocity to see if i can get a reaction from the pendulum but this did not work for me either…

i am using the following line to move/jump with my player.

playerController.Move(moveDirection * Time.deltaTime);

BTW there is a similar question here but that particular post was talking about trying to achieve this manually without using rigid bodies. I am using rigid bodies which will hopefully make things easier.

If anyone out there can give me some pointers on the simplest way to achieve this i would be very grateful!

PS please excuse my awful drawing :slight_smile:

Thanks!

Since you are moving your character through a character controller, you are not engaging the physics engine for movement. And so the pendulum is not being impacted. As an experiment you might want to add a Rigidbody to your character and move it through force to see the impact on the pendulum. The only solution I can see is to fake it…that is to calculate the acceleration of the character each frame and apply force manually to the bob.