How to animate this grass off a vertex, and make it move out of the way of the charchter?

This Is a picture of off which point I would like to swing this fern back and forth in a wind sway like animation, I can’t figure out how to do this, and I have basic knowledge of the animator. [21875-unity+2014-02-07+20-21-22-89.png|21875]

These images are a demonstration from wind waker, you will notice that the fern/grass pivots off the same point, and move away from the character, I would like to do the same, and I assume one would use ray casting, but I just wanted to get some opinions on it first.

Imgur link:

-also one last thing, how can I get rid of the pink thing in the background, it’s a left over behavior I Think…

I think the pink thing means you are missing a material or texture, it can’t be displayed correctly till you fix that.

Hmm for rotating it away from the player there are a lot of different solutions you could try but I can’t think of any off the top of my head which would be worthy of an actual code example.

I would start with a OnTriggerEnter event. You could then retrieve the players transform location by the player’s collider, maybe create a new Transform point on the plant’s script for the players location.

Ideally you could use a LookAt() with the plant and then play a kind of “Knocked Back” animation, but given that plants can’t really LookAt() like an enemy would it’s really hard to say if that would look goofy.

If you have the transform point of the player though you could probably do some math to determine which animation to play based on the angle. Math problems specifically like this in programming are not my strong point though so I have no example.

You could even have 4-6 little colliders on the plant and a bool for when the player is in the collider. The colliders could be positioned on all side of the plants and be assigned a number to determine which one is active.

For example collider 1 could be on the north side of plant, if player hits it the plant plays the animation where it gets knocked south. Position 2 could be east, 3 south, 4 west.

Those might be bad solutions but taking a crack at it.