question
15 posts • Page 1 of 1
Re: question
That has been Suggested: onIdle, etc. It would be great but no, to my knowledge there is not a way to do this (Wish there was)
-
niffirg1 - Posts: 376
- Joined: Mon Aug 31, 2009 10:31 pm
- Location: The Great American South!
Re: question
Yes there is.
If you want to use scene.my. variables
Open the console and type in this two lines of code
After that create the object and the laser. In the object's onHitByLaser type in:
In the object's controllerAcc type in:
If you hate scene.my. variables
First create the object and the laser. Define a new object variable in the object's scripting menu. In the line at the bottom type in:
If you don't want to define a new object variable use one which already exists and which you don't need (for example textScale)
In the object's onHitByLaser type in:
In the object's controllerAcc type in:
And that's it. Now the event will be executed every time the laser does NOT hit the object
Only important if you want to use the geometry controller:
The cool thing is you still can use controllerAcc for steering objects. The only thing is: if you want to change controllerAcc in the geometry controller menu you can't do it there. But you can change the acceleration values in your scene.my.onIdle code from 11.0 to the value you want.
If you want to use scene.my. variables
Open the console and type in this two lines of code
- Code: Select all
scene.my.timecheck := 0.0
scene.my.onIdle := { (sim.time - scene.my.timecheck > 1/sim.frequency) && sim.running ? {*do sth when not colliding*} : { }; 11.0 }
After that create the object and the laser. In the object's onHitByLaser type in:
- Code: Select all
(e)=>{scene.my.timecheck = sim.time}
In the object's controllerAcc type in:
- Code: Select all
{scene.my.onIdle}
If you hate scene.my. variables
First create the object and the laser. Define a new object variable in the object's scripting menu. In the line at the bottom type in:
- Code: Select all
timecheck := 0.0
If you don't want to define a new object variable use one which already exists and which you don't need (for example textScale)
In the object's onHitByLaser type in:
- Code: Select all
(e)=>{timecheck = sim.time}
In the object's controllerAcc type in:
- Code: Select all
{ (sim.time - timecheck > 1/sim.frequency) && sim.running ? {*do sth when not colliding*} : { }; 11.0 }
And that's it. Now the event will be executed every time the laser does NOT hit the object
Only important if you want to use the geometry controller:
The cool thing is you still can use controllerAcc for steering objects. The only thing is: if you want to change controllerAcc in the geometry controller menu you can't do it there. But you can change the acceleration values in your scene.my.onIdle code from 11.0 to the value you want.
-
KarateBrot - Posts: 825
- Joined: Mon Aug 31, 2009 7:32 pm
- Location: Germany
Re: question
Wow... Never knew that.
-
niffirg1 - Posts: 376
- Joined: Mon Aug 31, 2009 10:31 pm
- Location: The Great American South!
Re: question
But I think an onIdle script would be easier
Cave Johnson wrote:Do you know who I am? I'm the man who's gonna burn your house down! With the lemons! I'm gonna get my engineers to invent a combustible lemon that burns your house down!
-
Matten - Posts: 435
- Joined: Mon Apr 05, 2010 2:03 pm
- Location: The Netherlands
Re: question
Meh, if you add features to fill every user's every need for a function, all you do is create unnecessary clutter.
The means to do this already exists, and is pretty straightforward, so I don't think a special function is needed for it.
The means to do this already exists, and is pretty straightforward, so I don't think a special function is needed for it.
.. ,__,_____
. / __.==--" - - - - - - - - ""
./#(-'
.`-' From http://www.ascii-art.de/. Modded by me to work in Arial.
. / __.==--" - - - - - - - - ""
./#(-'
.`-' From http://www.ascii-art.de/. Modded by me to work in Arial.
a Mammoth wrote:be boring and interesting.
I didn't know you could go up 3.1.3! Thanks Mystery person!Mystery wrote:If you were jailbreaker you shouldn't have when't up the 3.1.3
-
Dakta - Posts: 417
- Joined: Sat Sep 12, 2009 4:36 pm
Re: question
There is no simple way to do it. But with quite a lot of scripting it can be done. I do hope they implement this in an easier form soon, and the same thing for on-collide with normal objects and shapes.
I don't suffer from insanity. I enjoy every minute of it.
-
Rrobba - [Best Sig 2010]
- Posts: 1480
- Joined: Mon Aug 31, 2009 6:01 pm
- Location: Gibraltar
Re: question
you can do this with oncollide too. you just have to put (e)=>{scene.my.timecheck = sim.time} into onCollide instead of OnHitByLaser
-
KarateBrot - Posts: 825
- Joined: Mon Aug 31, 2009 7:32 pm
- Location: Germany
Re: question
Okey how would I go around making something when it's hit and when it's not do another thing?
make sure to check out my work.
-
Rideg - Posts: 948
- Joined: Tue Dec 15, 2009 5:17 pm
- Location: Östersund, Sweden
Re: question
For example if you want to make a loop that is executed every frame. But you can switch the loop off by touching the block.
Cave Johnson wrote:Do you know who I am? I'm the man who's gonna burn your house down! With the lemons! I'm gonna get my engineers to invent a combustible lemon that burns your house down!
-
Matten - Posts: 435
- Joined: Mon Apr 05, 2010 2:03 pm
- Location: The Netherlands
Re: question
Rideg wrote:I solved this with a DEactivasionbutton on the laser
I was searching for that How does it work?!
Cave Johnson wrote:Do you know who I am? I'm the man who's gonna burn your house down! With the lemons! I'm gonna get my engineers to invent a combustible lemon that burns your house down!
-
Matten - Posts: 435
- Joined: Mon Apr 05, 2010 2:03 pm
- Location: The Netherlands
Re: question
here's the code:
Just paste it in the algodoo window
- Code: Select all
// Phunlet created by Algodoo v1.7.1
FileInfo -> {
title = "Missile Launcher v1.6.1 [PROTOTYPE]";
author = "Rideg";
version = 8
};
Scene.addLaserPen {
geom := -1;
pos := [-0.21875, 0.5414031];
velocity := +inf;
fadeDist := 25.0;
maxRays := 1;
cutter := false;
opaqueBorders := true;
showLaserBodyAttrib := true;
size := 0.08280628;
collideSet := 127;
collideWater := true;
color := [1.0, 0.0, 0.0, 1.0];
onLaserHit := (e)=>{};
entityID := 15225;
zDepth := 23.0;
rotation := 1.5707964;
activationButton := "on toggle return"
}
Just paste it in the algodoo window
make sure to check out my work.
-
Rideg - Posts: 948
- Joined: Tue Dec 15, 2009 5:17 pm
- Location: Östersund, Sweden
Re: question
Rideg wrote:here's the code:
- Code: Select all
// Phunlet created by Algodoo v1.7.1
FileInfo -> {
title = "Missile Launcher v1.6.1 [PROTOTYPE]";
author = "Rideg";
version = 8
};
Scene.addLaserPen {
geom := -1;
pos := [-0.21875, 0.5414031];
velocity := +inf;
fadeDist := 25.0;
maxRays := 1;
cutter := false;
opaqueBorders := true;
showLaserBodyAttrib := true;
size := 0.08280628;
collideSet := 127;
collideWater := true;
color := [1.0, 0.0, 0.0, 1.0];
onLaserHit := (e)=>{};
entityID := 15225;
zDepth := 23.0;
rotation := 1.5707964;
activationButton := "on toggle return"
}
Just paste it in the algodoo window
Thanks
Cave Johnson wrote:Do you know who I am? I'm the man who's gonna burn your house down! With the lemons! I'm gonna get my engineers to invent a combustible lemon that burns your house down!
-
Matten - Posts: 435
- Joined: Mon Apr 05, 2010 2:03 pm
- Location: The Netherlands
15 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest