lua + physics help

lua + physics help

Postby cornfield gamer » 15 Feb 2014, 22:47

i need some help. i am making a level i have an emiter that i want to shoot a porjetile. that is easy but i need the porjetile to land at the exsact spot i click (on my tab) no mater how far it travels and the pojetile is not geting more velocity after initial launch. how would i do this?
cornfield gamer
 
Posts: 14
Joined: 10 Jan 2014, 21:14

Re: lua + physics help

Postby zardOz » 16 Feb 2014, 13:59

What you describe can only be done in zero g, but it is rather involved, need cursor position and angle from launch point to the cursor position and a "mouse click release" trigger...
New to Principia? Check out my extensive Parts Tutorials, Tricks and Examples
My Apparatus Engineering series : The Way Things Work zardOz on Apparatus
zardOz
 
Posts: 211
Joined: 05 Nov 2013, 12:32

Re: lua + physics help

Postby zardOz » 16 Feb 2014, 15:19

Ill post an example "touch aimer for cfg"
New to Principia? Check out my extensive Parts Tutorials, Tricks and Examples
My Apparatus Engineering series : The Way Things Work zardOz on Apparatus
zardOz
 
Posts: 211
Joined: 05 Nov 2013, 12:32

Re: lua + physics help

Postby jammer312 » 16 Feb 2014, 19:44

Or (in non-zero g) you need to write complex artillery lua script.
jammer312
 
Posts: 55
Joined: 29 Nov 2013, 13:36
Location: Russia,Korolev

Re: lua + physics help

Postby cornfield gamer » 18 Feb 2014, 19:29

that was my plan and I found a physics equation but it did not come up with a number. so I did the calculation with a calculater and it came out something like 2.51. I can't figure why it did not Work.
I do not come out with a lot of levels
but when I do I try to make them worth while.
cornfield gamer
 
Posts: 14
Joined: 10 Jan 2014, 21:14

Re: lua + physics help

Postby spyninja242001 » 30 Apr 2014, 19:47

I need help on how to measure speed with lua
spyninja242001
 
Posts: 12
Joined: 01 Mar 2014, 18:23

Re: lua + physics help

Postby sdac » 01 May 2014, 19:39

spyninja242001 wrote:I need help on how to measure speed with lua


Velocity is the derivative of position, take two positions at any two points in time and divide them by the time difference. The time difference in Principia is always 8 milliseconds.

I.e. (position-last_position)/0.008

At the end of the tick, store position in last_position for the next tick.

Speed is simply the absolute value of the velocity.

Also, please create new threads for your questions in the future instead of reviving old threads.

You can also use the velocity meter object to get the value from the physics engine directly.
sdac
Site Admin
 
Posts: 244
Joined: 03 Aug 2012, 16:21
Location: Sweden


Return to General chat

Who is online

Users browsing this forum: No registered users and 1 guest

cron