- Home /
Character move in four directions. Change skeleton?
Hello!
Currently I am working on a little 2d game where the character should be able to move in four directions and facing in four directions. Since I want to make an equipment system so that the player can equip different combinations of items I can't simply make spritesheets for each combination of item. So I thought of rigging the player character. But how do I handle this when the player change the movedirection? For example if the character walk right and wear the weapon in the right hand do I need to change the skeleton when the player want to move upwards? Also I need four sprites for each item? Im a bit confused and also pretty new to unity. I hope you got my question, if not please ask :)
Answer by DD_Hieu_san · May 19, 2021 at 11:39 AM
A little late.. But my solution is: - If it's a Playable Character => Make all 4 skeletons, sprite arts of all 4 directions. Create animation all 4 of them. Then you should have 4 game objects with 4 animations. In your movement script just turn them on and off base on which direction the character is moving (you can check with input value or vector value base on which type of game you're making). For example: If the character is moving to the right then turn the other three GameObjects (left,up,down) off by using GameObject.SetActive(false) and keep the right direction GameObject on and its animation playing. - If it's a NPC => You could do the same thing but it's base on which method you use to make the npc moving. For example: You make a npc move to random 4 direction by using rigidbody.velocity or addforce... When the npc change direction you detected the change and do the same thing toggling on and off direction GameObjects just like the Playable Character. It's the best I could think of... Hope this help.
Your answer
Follow this Question
Related Questions
Are Angle Deformers & CAT muscles supported? 0 Answers
What is the advantage of using the humanoid animation type vs using a generic animation type? 2 Answers
Everything works in Maximo but exporting it to Unity will give me problems.. 0 Answers
How can i animate my Object? (bones available) 1 Answer
Car suspension rig in blender 0 Answers