http://imageupload.org/?di=1012967969940

let say A to B 100 distance in gmod. already know A & B position

fire a entity from A to B take 2 seconds

how to cacluate the angle, velocity?

http://imageupload.org/?di=1012967969940

let say A to B 100 distance in gmod. already know A & B position

fire a entity from A to B take 2 seconds

how to cacluate the angle, velocity?

0=Vy*t+.5*a*t^2

so

0=vi*2+.5*-600*2^2

so Vy will need to be 600.

it will need to go 100 in. in 2 sec so Vx = 100/2 = 50

Angle = tan^-1(Vy/Vx) = 85.2363583092738 deg

and

Initial Velocity = (Vx^2+Vy^2)^.5 = 602.079728939615

need care the entity mass??

If you’re applying a force then yes since A=F/M and you would need to accelerate it to the needed velocity.

The actual math in finding the angle and velocity needed though doesn’t require mass because the acceleration of gravity is the same on all masses.

Also keep in mind that I neglected air resistance and source engine has air resistance.

is there a sample function in lua or c to get a Angle and Initial Velocity, when i passed entity mass, time, and two position?

i am not good in maths

Well this returns the objects current angle http://wiki.garrysmod.com/?title=Entity.GetAngles

and this will return its velocity http://wiki.garrysmod.com/?title=Entity.GetVelocity

To set the object’s velocity you can give it an angle. Then turn that angle into a vector which can be multiplied by the needed velocity.

[lua]Entity:SetVelocity(Angle(Yourangle,direction,0):Forward()*NeededVelocity --Forward() turns the angle into a normalized vector (A vector with length of 1)

–multiplying the normalized vector by velocity will create the force components needed to fling your object.[/lua]

No, but you can use this formula to calculate the velocity

Kinetic Energy = 0.5 * mass * velocity^2

You need basic A level physics knowledge to do this kind of stuff, go read a book or something. Or just use the inbuilt physics.