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.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
To help users post good questions and use the site effectively we have posted a user guide. Please check it out.
Answers and Comments
No one has followed this question yet.
Make grenade roll out when it leaves hand
Unity3D grenade not exploding correctly
Explosion Damage not being applied.
Make grenade apply force to rigidbodies around it
How to throw objects/grenades in looking height?