A couple of questions

For topics that don't fit under the other topics or forums.

A couple of questions

Postby The average Joe » Thu Sep 24, 2015 6:56 pm

Hi, I'm not so much new in Algodoo (one of the first users of Phun) but since there isn't any movement after the current version, questions arised ...

1. 60Hz or 120Hz for simulation frequency? 120Hz seems better for collision detection especially for testing suspensions ...
2. Not enough tutorials for the scripting. Is there a full documentation for it?
3. List of the known and not so well known pitfalls?

Thanks in advance

Edit: btw after posting this:
Code: Select all
[phpBB Debug] PHP Notice: in file /antispam/spam_words.php on line 62: preg_match_all() [function.preg-match-all]: Delimiter must not be alphanumeric or backslash
[phpBB Debug] PHP Notice: in file /antispam/spam_words.php on line 62: preg_match_all() [function.preg-match-all]: Delimiter must not be alphanumeric or backslash
[phpBB Debug] PHP Notice: in file /antispam/spam_words.php on line 62: preg_match_all() [function.preg-match-all]: Delimiter must not be alphanumeric or backslash
[phpBB Debug] PHP Notice: in file /antispam/spam_words.php on line 62: preg_match_all() [function.preg-match-all]: Delimiter must not be alphanumeric or backslash

Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/phun/algodoo/forum/includes/functions.php:3247) in /usr/www/users/phun/algodoo/forum/includes/functions.php on line 3828

Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/phun/algodoo/forum/includes/functions.php:3247) in /usr/www/users/phun/algodoo/forum/includes/functions.php on line 3830

Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/phun/algodoo/forum/includes/functions.php:3247) in /usr/www/users/phun/algodoo/forum/includes/functions.php on line 3831

Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/phun/algodoo/forum/includes/functions.php:3247) in /usr/www/users/phun/algodoo/forum/includes/functions.php on line 3832

In fact I'm a coder (C/C++, PHP, JS) and this is waaaay beyond my ideas for secure installation of a forum software ...
User avatar
The average Joe
 
Posts: 14
Joined: Thu Sep 24, 2015 6:35 pm

Re: A couple of questions

Postby electronicboy » Fri Sep 25, 2015 12:58 pm

1. Depends on your usage, 60Hz will suffice for most basic scenes however once you start playing with fast collisions and stuff like that, you'll need to up the frequency.

2. There is a large post in the thyme section with a starting tutorial, as well as another with an outdated list of functions. Best you can do is dissect others scenes. Thyme is unsupported by Algoryx, basically, hence why there is no official documentation on it or anything.

3. There isn't really a list, however you can always search the help/bug report section as well as the other related parts of the forums.


The forum software is outdated, I think that a PHP upgrade by the hosting provider for the server or Algoryx ended up partially breaking that, however Algoryx is the only people whom can upgrade it but the custom edits have seemingly put them off doing that...
When asking for help, READ THE STICKIES!
electronicboy
 
Posts: 1694
Joined: Mon Aug 31, 2009 6:18 pm

Re: A couple of questions

Postby The average Joe » Sat Sep 26, 2015 11:48 am

Hmmm, do you know what integration methods are used in Phun/Algodoo? Think in these apps there are many submethods for friction, airfriction and collision + couple more (if true) which I don't know ...

Edit: Read those two threads (tutorials and function list) and the information is too general and sparse. Still cannot find the proper way of getting current data values of an object. For example current position, speed, etc ... Why the **** someone would create a script engine for an app like this one when there are JS, Lua, etc?
User avatar
The average Joe
 
Posts: 14
Joined: Thu Sep 24, 2015 6:35 pm

Re: A couple of questions

Postby The average Joe » Thu Oct 01, 2015 2:33 am

Anyway, wasted a good portion of my free time to read almost the whole 'Thyme' section ... Which means I have more questions:

(My conclusion is that this Thyme scripting system is rly terrible, for the time of reading those shits I probably can make the same with JS+canvas if I had a bigger physics background and nerves...)

1. Is there a way to make a loop for smooth stopping of motorized hinges? Their braking behaviour is instant, I can do
Code: Select all
hingeA.motorSpeed -= calliperForce + heatFactor

for a simple and rough simulation, but I don't see while() or do(). So I must use 'e.pressed', right?
2. Again about hinges:
Motor speed: 15.0 rpm
Script menu: hinge.motorSpeed = 1.5707964 ... It should be 1.5, not a value with 7 numbers after decimal point. Is it normal?
3. Seems 'update' section of object's 'Script menu' is the best place for general function calling. But how much times they are called from there - based on sim frequency or some other internal variable of Algodoo?
User avatar
The average Joe
 
Posts: 14
Joined: Thu Sep 24, 2015 6:35 pm

Re: A couple of questions

Postby ducky21 » Thu Oct 01, 2015 7:26 am

For getting the data values of an object, you can use entity.pos and entity.vel. For referring to the entity the code is on you just do vel and pos with no object. In general you can look at the items in the script panel to find what the variables are called.

For loops have the syntax:
Code: Select all
for(n,(i)=>{  })

but if you do this it will evaluate all on the same tick, so you may not want that. Instead, consider putting everything in update/onCollide/onHitByLaser and using that as your loop.
(more info on loops here: viewtopic.php?f=13&t=814&p=8269&hilit=loop#p8269)

For hinge.motorSpeed, that's measured in radians/sec iirc, so 1 revolution per 4 seconds is 90 degrees is 1.57etc radians.

Update is a risky place to put some code because it runs even when sim is paused. I did a quick test and it does look like onHitByLaser and onCollide run at the simulation speed.

I unfortunately don't have an answer for your questions on integration methods or why Algodoo doesn't just use Lua or JS.

And finally, I would encourage you to try making your own physics engine. It would be a really awesome project and if you could pull it off it would be awesome!
User avatar
ducky21
 
Posts: 301
Joined: Tue Aug 03, 2010 8:58 pm

Re: A couple of questions

Postby The average Joe » Thu Oct 01, 2015 8:10 pm

Yeah, already noticed for loop in other threads, but executing the whole loop in one tick is weird and bad for some situations. I'm sure that it is possible to use internal sim timer to make pauses between each loop step ...

About calling a function from 'update' section - if this is the case, ie the code is running even when simworld is paused, it is perfect because we need our data to have closest approximation to the real world data.

Well, if anyone here knows very good online documentation and tutorials about integration methods used in Algodoo, I'll be happy to read them and give it a try ...
User avatar
The average Joe
 
Posts: 14
Joined: Thu Sep 24, 2015 6:35 pm

Информативно

Postby BefGuace » Tue Dec 20, 2016 2:02 am

Информативно
BefGuace
 
Posts: 1
Joined: Tue Dec 20, 2016 2:01 am

Re: A couple of questions

Postby The average Joe » Mon May 01, 2017 8:03 pm

ducky21 wrote:And finally, I would encourage you to try making your own physics engine. It would be a really awesome project and if you could pull it off it would be awesome!


Well, after year and a half I just started. The project is in very early stage - not everything is calculated, or it's just wrong, code is a small mess (somewhat readable, procedural for all starters in coding) and generally it's a 3D flight sim (top-down view), but it works

https://github.com/quantuumsnot/botlab
User avatar
The average Joe
 
Posts: 14
Joined: Thu Sep 24, 2015 6:35 pm


Return to Algodoo in general

Who is online

Users browsing this forum: No registered users and 2 guests