Rotate against player when hit

Hi there!

I’m working on a game on where the player is going to be able to chop down trees. Trees have health, and the player must hit them until the tree health is below 0, then it would just destroy.

The problem is, I’m trying to give a nice feeling when hitting the trees, my idea is to make the tree rotate against the direction the player is on, so it definitely feels like you punched the tree.

Here’s an image about what I’m trying to accomplish:

And here’s what I tried:

Quaternion.Euler(transform.eulerAngles - player.position * 5);

With what I tried, it actually rotates, but it’s not against the player’s position, it just rotates against some position I don’t understand…

Where am I wrong? I’ve been for hours with this and don’t seem to understand what’s wrong.

PS: The script is on the tree, ofcourse.

After taking a deep breath I could see the mess I was doing, so I’ve got the solution.

Here’s what I did:

Quaternion.FromToRotation(Vector3.up, player.forward * 5);

Sorry for creating the thread!