Velocity question

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

Velocity question

Postby icrls984 » Thu Mar 20, 2014 5:04 am

Is there a formula for calculating the total speed of a object? If so, how? I would like to make an object explode if it collides with other objects too fast.
.
User avatar
icrls984
 
Posts: 80
Joined: Thu Jun 13, 2013 6:33 am

Re: Velocity question

Postby Kilinich » Thu Mar 20, 2014 8:15 am

Do you mean speed of impact? Well, something like this:

onCollide = (e) => {iv := e.this.vel - e.other.vel; spd := (iv(0)^2 + iv(1)^2)^0.5; spd > 10 ? { <do explosion> }:{}}
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: Velocity question

Postby icrls984 » Sun Mar 23, 2014 4:20 am

Thank you. I will try this.
.
User avatar
icrls984
 
Posts: 80
Joined: Thu Jun 13, 2013 6:33 am

Re: Velocity question

Postby Algonaut » Sun Jun 08, 2014 2:23 pm

Hi
I have a question: Why I can't accessing to velocity of an object? I have a rectangle. Text in rectangle should show me the speed of them if he collide something:

text = {scene.my.speed + ""}
onCollide = (e) => {scene.my.speed := e.vel}

but it doesn't works! The same function but with position works! By touching I can see the position of collide on rectangle

I already tried with:
(e) => {scene.my.speed := e.this.vel}
(e) => {scene.my.speed := this.vel}
(e) => {scene.my.speed := e.velocity}
(e) => {scene.my.speed := e.this.velocity}
and so on...

Is it a bug? I use Algodoo v2.0.1
Algonaut
 
Posts: 13
Joined: Mon May 05, 2014 8:30 am

Re: Velocity question

Postby electronicboy » Sun Jun 08, 2014 6:53 pm

Try {"" + scene.my.speed}, that way Algodoo knows it's adding onto a string. also, for collisions it's e.this.vel or e.other.vel.
When asking for help, READ THE STICKIES!
electronicboy
 
Posts: 1694
Joined: Mon Aug 31, 2009 6:18 pm

Re: Velocity question

Postby Algonaut » Sun Jun 08, 2014 8:36 pm

thanks for answer!
see the picture. What I did wrong?
It doesn't work! :cry:
The text keeps "0"

algo.JPG
algo
algo.JPG (28.19 KiB) Viewed 4973 times
Algonaut
 
Posts: 13
Joined: Mon May 05, 2014 8:30 am

Re: Velocity question

Postby Kilinich » Sun Jun 08, 2014 9:00 pm

1) you need to create variable from console before use
2) it should show speed value for box only on collide (one time)
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: Velocity question

Postby electronicboy » Sun Jun 08, 2014 9:28 pm

Also, you made a spelling mistake in the oncollide box.
When asking for help, READ THE STICKIES!
electronicboy
 
Posts: 1694
Joined: Mon Aug 31, 2009 6:18 pm

Re: Velocity question

Postby Algonaut » Sun Jun 08, 2014 11:30 pm

1) I did so
2) I know.

@ electronicboy : I have corrected, but nothing changed :?

see that:
Image
algo.JPG
nothing happened
(30.38 KiB) Not downloaded yet


could you try it on your computer ? - maybe it is not possible what I want to do
Algonaut
 
Posts: 13
Joined: Mon May 05, 2014 8:30 am

Re: Velocity question

Postby Kilinich » Mon Jun 09, 2014 12:47 pm

We could not help you to do elementary things :wtf:
Look at attached scene:
Attachments
onCollide.phz
on collide demo
(9.51 KiB) Downloaded 82 times
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: Velocity question

Postby Algonaut » Mon Jun 09, 2014 2:57 pm

I don't understand, why it doesn't work! It's elementary :( :cry:
Maybe some variables you can't read??? :?
Algonaut
 
Posts: 13
Joined: Mon May 05, 2014 8:30 am

Re: Velocity question

Postby Algonaut » Mon Jun 09, 2014 4:51 pm

I've just tested it with other variables like angle, anglevel, size ... . Nothing works. Only position works.
Algonaut
 
Posts: 13
Joined: Mon May 05, 2014 8:30 am

Re: Velocity question

Postby Kilinich » Mon Jun 09, 2014 9:02 pm

It works fine with any e.this. variables like angle, angVel, size...
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: Velocity question

Postby Algonaut » Tue Jun 10, 2014 12:48 am

I just managed it! :clap:
The reason was this function: "readable(owner) ..."
I accidentally found it in a scene here on this site! :thumbup:
I tried everything but nothing works. I can't read some variables without the function readable!

look at the background on the picture: You see the velocity of the object
Image
Algonaut
 
Posts: 13
Joined: Mon May 05, 2014 8:30 am

Re: Velocity question

Postby Kilinich » Tue Jun 10, 2014 10:29 am

Do you use 2.1.0 ?
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: Velocity question

Postby Algonaut » Tue Jun 10, 2014 2:06 pm

Kilinich wrote:Do you use 2.1.0 ?

no, 2.0.1
Why are you asking?
Algonaut
 
Posts: 13
Joined: Mon May 05, 2014 8:30 am

Re: Velocity question

Postby Kilinich » Wed Jun 11, 2014 9:16 pm

Algonaut wrote:
Kilinich wrote:Do you use 2.1.0 ?

no, 2.0.1
Why are you asking?

:shock:
Because thats why it's not working. Please update.
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: Velocity question

Postby Algonaut » Mon Jun 16, 2014 12:03 am

Kilinich wrote:
Algonaut wrote:
Kilinich wrote:Do you use 2.1.0 ?

no, 2.0.1
Why are you asking?

:shock:
Because thats why it's not working. Please update.

если я апдэйтну, то моя крякнутая версия будет дальше работать?
Algonaut
 
Posts: 13
Joined: Mon May 05, 2014 8:30 am

Re: Velocity question

Postby Kilinich » Mon Jun 16, 2014 8:00 am

Algonaut wrote:если я апдэйтну, то моя крякнутая версия будет дальше работать?

Algodoo 2.1 полнофункциональная и бесплатная, чудо ты. Учи английский.
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: Velocity question

Postby Algonaut » Tue Jun 17, 2014 12:30 am

Kilinich wrote:
Algonaut wrote:если я апдэйтну, то моя крякнутая версия будет дальше работать?

Algodoo 2.1 полнофункциональная и бесплатная, чудо ты. Учи английский.

sometimes, I will do it :roll:
Algonaut
 
Posts: 13
Joined: Mon May 05, 2014 8:30 am


Return to Algodoo in general

Who is online

Users browsing this forum: No registered users and 3 guests

cron