- Home /
How can I make an arm a slingshot for projectile, and make my character move back and pick up another object after throwing?
In the game there is a character who is throwing objects, I can't figure out how I can make his arm the slingshot and how to make him move back once he has thrown an object.
Take look at joints. http://unity3d.com/learn/tutorials/modules/beginner/physics/joints
I want it to be similar to angry birds, in which the player gets to drag the arm and then once released the character throws the object. Once he has thrown it I want the distance to increase and I want the character to pick up another object to throw once again.
Answer by KittyKatKat · Jan 07, 2015 at 03:12 PM
I feel like you didn't give a lot of information, but if you thought about waiting for the player to swing his arm and Then fire a ball, you can simply delay it by the time of the animation (Either by using coroutine, or invoke).
After that simply apply force to your character in the -z axis (considering he's facing the z axis) and put another ball (or whatever he's throwing) in his hand. Instantiate is a bit costly method, so I wouldn't advise it for the final step. Use invoke only after the delay of swinging. To make the player "hold" the object before swinging, maybe you could just turn the mash off/on depending when you want the object to appear in his hand.
What do you mean by "delay it by the time of the animation". How can I "apply force" to the character each time he throws something to make him move further backwards. There are several different objects that the character can throw & once the player moves back I want him to pick up another object. The basic principle of the game is like angry bird, in which the arm would be the slingshot which I am having trouble scripting.