Hi all! I'm currently developing on a game called Three Worlds, a 3rd Person game. Everything is all set up, the levels, player etc. Now i want to get started on weapons. I've decided to start off with the grenades. I managed to create a 'throwing grenade' animation for the character and now here's the tough bit.
Just as i click the button to throw the grenade (Left Mouse Button), the grenade appears when the character animation looks like as if he is throwing the grenade and the grenade is then thrown somewhere, like force is applied to it with the rigibody attached, and after about 3 seconds, the grenade explodes.
I've managed to create the models, the explosion particle effects but i want to know the coding for this to work. I'm not much of an experienced scripter so i'm not exactly sure what to do.
Have you made the animation using bones if so you can easily parent the grenade to your hand bone to make it follow the movement of the arm. so you instantiate at transform.position of the bone. then you could try checking the speed and detach it with this force not sure if it would work though. just an idea
Also you can give it a layer like grenade, and go into the physics options and turn off physics between the player and the grenade to ensure that your model doesn't interfere with it.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
No one has followed this question yet.
Make grenade roll out when it leaves hand
Make grenade apply force to rigidbodies around it
Only 2 Grenades
2D explosion that targets specific gameobjects
OverlapSphere not causing damage? - Solved