Quantcast
Channel: Questions in topic: "parenting"
Viewing all articles
Browse latest Browse all 302

How to flip objects that are currently rotating?

$
0
0
In [this gif][1], what I want is for the arms and bow to flip when the player is flipped, so it doesn't look like they are upside down. I have tried making the arms a child of a parent, and then flipping the parent's x and y, but it didn't seem to do anything, except for [rotating the arms][2] when the main rotating has stopped. This the code (in the Bow object) i am using for rotating the arms and bow: // Rotate Bow float angle = Mathf.Atan2(difference.y, difference.x) * Mathf.Rad2Deg; pivot.rotation = Quaternion.AngleAxis(angle, Vector3.forward); RotatePlayer(); // Rotate Arm if (playerBowHoldShoulder != null) { playerBowHoldShoulder.rotation = Quaternion.AngleAxis(angle - 5.78f, Vector3.forward); playerBowDrawShoulder.rotation = Quaternion.AngleAxis(angle, Vector3.forward); } The RotatePlayer() method just flips the player's Y rotation when the bow's xPos is greater than the player's xPos, and vice versa, which works fine as you can tell by the first gif. This below is the hierarchy view of the Player object ![alt text][3] Where the highlighted areas are the one's affected by the rotation you see in the gifs. Any help or ideas would be appreciated, thanks! Let me know if I need to provide more info. [1]: https://i.imgur.com/gClKbzk.gifv [2]: https://i.imgur.com/QZqlWU8.gifv [3]: https://i.imgur.com/8N0ZVdu.png

Viewing all articles
Browse latest Browse all 302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>