Need help with velocity calculation
2 posts • Page 1 of 1
Need help with velocity calculation
maybe this`ll be karatebrots work again (that lil`mathsfreak ;P) but I just can`t get this scrpt to work
I want the spawned object to have a velocity of 50m/s^2 while pointing at the cursor.
I used the arctan to calculate the angle of the vector pointing at the cursor first, then calculating the x and y velocities for tat angle.
well, that`s it! thanks up front!
Greetings
PlanckBanck
- Code: Select all
vel := [(50 * sin(atan((app.mousepos(0)) - (e.pos(0)) / (app.mousepos(1) - e.pos(1))))), (50 * cos(atan((app.mousepos(0)) - (e.pos(0)) / (app.mousepos(1) - e.pos(1)))))]
I want the spawned object to have a velocity of 50m/s^2 while pointing at the cursor.
I used the arctan to calculate the angle of the vector pointing at the cursor first, then calculating the x and y velocities for tat angle.
well, that`s it! thanks up front!
Greetings
PlanckBanck
The world is a gas-station, where you`re allowed to smoke. -Friedrich Dürrenmatt
I forgot 2/3 of my scripting knowledge T.T
I forgot 2/3 of my scripting knowledge T.T
-

PlanckBanck - Posts: 48
- Joined: Sun Nov 22, 2009 5:35 pm
- Location: In the Bottoms of Berlin
Re: Need help with velocity calculation
there's no redirection for the proper trigonometric function for arctangents, unlike sin and cos.
the config.cfg file used to have 2 lines to redirect the functions
sin = {math.sin}
cos = {math.cos}
hovewer, it doesn't have for atan. this means you'll need to use math.atan instead of atan.
the config.cfg file used to have 2 lines to redirect the functions
sin = {math.sin}
cos = {math.cos}
hovewer, it doesn't have for atan. this means you'll need to use math.atan instead of atan.
Jrv wrote:TC42 wrote:Quite honestly, I didn't think anyone on 4chan has that good a use of grammar, spelling, usage, mechanics, ect.
But I've never been there, so I may be wrong.
GTFO newfgt
-

RA2lover - Posts: 607
- Joined: Mon Aug 31, 2009 8:43 pm
- Location: Brazil
2 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 5 guests



