- Home /
Calculate Bullet based on enemy speed and distance from player
Here is a screenshot of what i'm trying to accomplish:
I do not want to use the built in unity moveto or anything like that. this is a pure c# formula question. How would I detect this without using help from unity. The reason why is because unity turns the bullets with movetowards which is not what I want...the bullet needs to remain straight and impact the target's position it's moving towards.
It is a prediction formula I'm looking for and it's pretty basic but i'm so use to just cheating and using stuff like vector3.movetowards that i'm not really sure how to do this.
What I've figured out so far is I will need to do something like this...
Vector3 newTargetPos = targetObject.Position * targetObject.Velocity;
Vector3 newPlayerPos = player.Position * player.Velocity;
and then shoot with newTargetPos + newPlayerPos
but what's the rest of the formula? how do I do the rest? bulletspeed would be used somehow in this right?