[ H3LP ] Velocity between two points?
Hello, I tried to find something like Velocity_by_aim, however, both the current position and the final position are attributed to the position of the player and the enemy respectively, i.e. I will get the origin of the player and the enemy, I want to create an entity that moves from where the player is as far as the enemy is. Can someone help me?
|
Re: [ H3LP ] Velocity between two points?
"velocity by aim" is not possible. The term velocity requires 2 things: speed and direction. "aim" only gives you direction, not speed.
You say you want to make something move from the player to the enemy so exactly what part are you unable to do? |
Re: [ H3LP ] Velocity between two points?
What I do not know is to calculate the axes (x, y, z) of the velocity to apply to the entity.
|
Re: [ H3LP ] Velocity between two points?
The direction vector between the two players is simply the subtraction of the two positions and dividing by the linear distance. When you do the subtraction, make sure the the order is done correctly:
<direction vector> = (<target position> - <from position>)/distance This is called a unit vector (a vector with a length of 1). Then, to turn it into a velocity vector, you simply multiply by the speed. |
Re: [ H3LP ] Velocity between two points?
Oh, thanks fysiks, work perfectly!
Here is the solution: Code:
|
| All times are GMT -4. The time now is 22:54. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.