- Home /
"newBullet.GetComponent.velocity += difference"?
Hi, I have a question that I'm kind of stuck on which I wanted to ask about if you don't mind.The question:"newBullet(which is a clone of the real bullet).GetComponent().velocity += difference(which is this variable "vector2 difference = mousePosition - transform.position"); So I almost know what this means but what I don't understand is that difference is the direction in vectors between the player and the mouse and it will vary(only if we move the mouse because the direction or difference will be different between the gun(which this script is attached to) and the mousePosition right) so that means that the bullet prefab velocity will vary because we are adding the difference to the velocity right.But then when I run this code the bullet prefab just shoots in the direction it spawned in.Do you know why this is happening? and how? thank you.
Yes sure but today unity is not opening it says java script error I don't know why I'll try to fix it.
Your answer
Follow this Question
Related Questions
Commercial Details Help? 1 Answer
My unity questions keep getting deleted? 2 Answers
Bolt Coding not working correctly? 0 Answers
C# Noob Confused About IEnumerator 1 Answer
Help with switching weapons (Unity 2D) 0 Answers