H
H
Herman Coffman2020-07-15 12:58:43
C++ / C#
Herman Coffman, 2020-07-15 12:58:43

Unity Vector3.forward, what's wrong, how can this not work?

Hello dear. The question is this: there is a simple code that creates a bullet, the position of which is set next to the barrel, and the rotation is done like the player to whom the weapon is attached.
BulletInstance = Instantiate(bullet, gunOne.transform.position, player.transform.rotation);

BulletInstance.GetComponent().AddForce(Vector3.forward * 1000);

Everything would seem simple, but the bullets fly only in one direction.
What could be wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2020-07-15
@freeExec

The force vector is indicated in absolute coordinates, which forward. Read the documentation, don't ask questions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question