- Home /
How to throw objects/grenades in looking height?
Hi,
I created a simple grenade throwing script, which that instantiates the grenade and the I throw it using:
grenadeClone.velocity = transform.TransformDirection(new Vector3(0,0,throwSpeed));
Everything is working, but how can I throw my greande in the camera angle/ looking height?
Thank you!
Comment
Answer by robertbu · Apr 28, 2014 at 03:17 PM
I assume you are trying to clone the grenades in front of the camera? Make your spawn point a child of the camera at the right position with the forward of the spawn point matching the forward of the camera. Change your throwing code to:
grenadeClone.velocity = transform.forward * throwSpeed;
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers