- Home /
How to fire my bow and arrow which I have imported into Unity from 3ds max
Hi Unity community,
I'm workin on a project which is to do with wind dynamics in Unity, assigning the wind to the grass and trees is easy though to code it is hard but another thing I wanted to have influence by the wind is the projectile. However I'm finding it hard just to fire my bow and arrow from a first person view the bow and arrow are attached as one object. If anyone can help I'll be grateful, below is the attached script for the bow and arrow.
var Bowandarrow:Transform;
var shootforce:float;
function Update () {
if(Input.GetMouseButtonUp(0))
{
var instanceBowandarrow = Instantiate(Bowandarrow, transform.position, transform.rotation);
instanceBowandarrow.rigidbody.AddForce(transform.forward * shootforce);
}
}
Answer by ckfinite · Mar 03, 2012 at 06:46 PM
I would separate the bow and arrow objects, then make prefabs out of them. Then, I would have the arrow be a separate prefab object, instantiated into the right position relative to the bow, rather than applying the force to the whole assembly.
Your answer
Follow this Question
Related Questions
Have my number of arrows correspond to arrows in my inventory 3 Answers
Arrows not stopping immediately when target hit? 3 Answers
How can I nail an arrow to an enemy(In 2D)? 1 Answer
How to get an animation script working? 1 Answer
I need help writing an animation script for a Bow and Arrow weapon 1 Answer