Velocity question
20 posts • Page 1 of 1
Velocity question
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.
.
-
icrls984 - Posts: 80
- Joined: Thu Jun 13, 2013 6:33 am
Re: Velocity question
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> }:{}}
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...
-
Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: Velocity question
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
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
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
thanks for answer!
see the picture. What I did wrong?
It doesn't work!
The text keeps "0"
see the picture. What I did wrong?
It doesn't work!
The text keeps "0"
- Algonaut
- Posts: 13
- Joined: Mon May 05, 2014 8:30 am
Re: Velocity question
1) you need to create variable from console before use
2) it should show speed value for box only on collide (one time)
2) it should show speed value for box only on collide (one time)
Dream of Algodoo as game development engine...
-
Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: Velocity question
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
1) I did so
2) I know.
@ electronicboy : I have corrected, but nothing changed
see that:
could you try it on your computer ? - maybe it is not possible what I want to do
2) I know.
@ electronicboy : I have corrected, but nothing changed
see that:
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
We could not help you to do elementary things
Look at attached scene:
Look at attached scene:
- Attachments
-
- onCollide.phz
- on collide demo
- (9.51 KiB) Downloaded 82 times
Dream of Algodoo as game development engine...
-
Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: Velocity question
I don't understand, why it doesn't work! It's elementary
Maybe some variables you can't read???
Maybe some variables you can't read???
- Algonaut
- Posts: 13
- Joined: Mon May 05, 2014 8:30 am
Re: Velocity question
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
It works fine with any e.this. variables like angle, angVel, size...
Dream of Algodoo as game development engine...
-
Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: Velocity question
I just managed it!
The reason was this function: "readable(owner) ..."
I accidentally found it in a scene here on this site!
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
The reason was this function: "readable(owner) ..."
I accidentally found it in a scene here on this site!
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
- Algonaut
- Posts: 13
- Joined: Mon May 05, 2014 8:30 am
Re: Velocity question
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
Algonaut wrote:Kilinich wrote:Do you use 2.1.0 ?
no, 2.0.1
Why are you asking?
Because thats why it's not working. Please update.
Dream of Algodoo as game development engine...
-
Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: Velocity question
Kilinich wrote:Algonaut wrote:Kilinich wrote:Do you use 2.1.0 ?
no, 2.0.1
Why are you asking?
Because thats why it's not working. Please update.
если я апдэйтну, то моя крякнутая версия будет дальше работать?
- Algonaut
- Posts: 13
- Joined: Mon May 05, 2014 8:30 am
Re: Velocity question
Algonaut wrote:если я апдэйтну, то моя крякнутая версия будет дальше работать?
Algodoo 2.1 полнофункциональная и бесплатная, чудо ты. Учи английский.
Dream of Algodoo as game development engine...
-
Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: Velocity question
Kilinich wrote:Algonaut wrote:если я апдэйтну, то моя крякнутая версия будет дальше работать?
Algodoo 2.1 полнофункциональная и бесплатная, чудо ты. Учи английский.
sometimes, I will do it
- Algonaut
- Posts: 13
- Joined: Mon May 05, 2014 8:30 am
20 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 3 guests