How to spawn hinges, fixates, and springs
33 posts • Page 1 of 2 • 1, 2
How to spawn hinges, fixates, and springs
Spawning hinges, fixates, or springs is actually quite easy.
You can either enter the following codes into an onCollide, onLaserHit, or the console. Press ~ or F11 to bring down the console and type in there.
How to spawn hinges
You need to know the geomID of the first and second objects that are going to be attached. Let's start with some control circles.
That will give us our circle with a preset geomID of 1. We will now do this again to get our second circle.
This gives us our second circle with a geomID of 2. 0In order for them to be hinged together they need to be on top of each other.
You should have something like this:
Now that we have our two circles with known geomID's we can spawn a hinge. To spawn a hinge you need to have the geomID of the object that will have something being attached to, the geomID of the object that is to be attached, and the position at which the hinge will spawn.
geom1 is the geomID of the first object. geom0 is the geomID of the second object. world0pos is the position at which the hinge will be spawned. This script will spawn a hinge connecting both circles at the mouse point.
This is what you should have now:
How to spawn fixates
Spawning a fixate is about the same as spawning a hinge.
Using our control circles we will spawn a fixate by using this script:
geom1 is the geomID of the first object. geom0 is the geomID of the second object. world0pos is the position at which the fixate will be spawned. This will spawn a fixate that connects the two circles at the mouse point.
This is what you should have now:
Sorry that this wasn't as long. It's only this short because it's about the same as spawning a hinge. c:
How to spawn springs
In order to spawn a spring you need to know the geomID of the first object, the geomID of the second object, the position of the first object, and the position of the second object. Using our control circles we will spawn a spring connecting the two.
(control circles for spring)
geom1 is the geomID of the first object. geom0 is the geomID of the second object. world0pos in this case is the position of geom1. world1pos is the position of geom0. Keep in mind that you can alter the values of the spring when you spawn them. You can change the constant(strength) by adding ;constant := number you want. You can change the dampingFactor(damping) by adding ;dampingFactor := number you want. You can change the length of the spring by adding ;length := number you want.
You should now have something like this:
You can either enter the following codes into an onCollide, onLaserHit, or the console. Press ~ or F11 to bring down the console and type in there.
How to spawn hinges
You need to know the geomID of the first and second objects that are going to be attached. Let's start with some control circles.
- Code: Select all
scene.addCircle({pos := app.mousePos; geomID := 1})
That will give us our circle with a preset geomID of 1. We will now do this again to get our second circle.
- Code: Select all
scene.addCircle({pos := app.mousePos; geomID := 2})
This gives us our second circle with a geomID of 2. 0In order for them to be hinged together they need to be on top of each other.
You should have something like this:
Now that we have our two circles with known geomID's we can spawn a hinge. To spawn a hinge you need to have the geomID of the object that will have something being attached to, the geomID of the object that is to be attached, and the position at which the hinge will spawn.
- Code: Select all
scene.addHinge({geom1 := 1; geom0 := 2; world0pos := app.mousePos})
geom1 is the geomID of the first object. geom0 is the geomID of the second object. world0pos is the position at which the hinge will be spawned. This script will spawn a hinge connecting both circles at the mouse point.
This is what you should have now:
How to spawn fixates
Spawning a fixate is about the same as spawning a hinge.
Using our control circles we will spawn a fixate by using this script:
- Code: Select all
scene.addFixJoint({geom1 := 1; geom0 := 2; world0pos := app.mousePos})
geom1 is the geomID of the first object. geom0 is the geomID of the second object. world0pos is the position at which the fixate will be spawned. This will spawn a fixate that connects the two circles at the mouse point.
This is what you should have now:
Sorry that this wasn't as long. It's only this short because it's about the same as spawning a hinge. c:
How to spawn springs
In order to spawn a spring you need to know the geomID of the first object, the geomID of the second object, the position of the first object, and the position of the second object. Using our control circles we will spawn a spring connecting the two.
(control circles for spring)
- Code: Select all
Scene.addSpring({geom1 := 1; geom0 := 2; world0pos := [-31.396013, 5.9814367]; world1pos := [-29.41792, 7.3022513]; size := 0.5})
geom1 is the geomID of the first object. geom0 is the geomID of the second object. world0pos in this case is the position of geom1. world1pos is the position of geom0. Keep in mind that you can alter the values of the spring when you spawn them. You can change the constant(strength) by adding ;constant := number you want. You can change the dampingFactor(damping) by adding ;dampingFactor := number you want. You can change the length of the spring by adding ;length := number you want.
You should now have something like this:
Last edited by standardtoaster on Sat Oct 31, 2009 11:58 pm, edited 2 times in total.
-
standardtoaster - Posts: 606
- Joined: Mon Aug 31, 2009 7:57 pm
Re: How to spawn hinges, fixates, and springs
Wow this is amazing
Did not know how to do this until now
Did not know how to do this until now
-
niffirg1 - Posts: 376
- Joined: Mon Aug 31, 2009 10:31 pm
- Location: The Great American South!
Re: How to spawn hinges, fixates, and springs
Cool tutorial. I like tutorials with images
Maybe you could also add the tip to type the script codes into the console if anyone doesn't know of other things than OnCollide.
Maybe you could also add the tip to type the script codes into the console if anyone doesn't know of other things than OnCollide.
-
KarateBrot - Posts: 825
- Joined: Mon Aug 31, 2009 7:32 pm
- Location: Germany
Re: How to spawn hinges, fixates, and springs
Right, I forgot about that. I'll edit that next week or so.
-
standardtoaster - Posts: 606
- Joined: Mon Aug 31, 2009 7:57 pm
Re: How to spawn hinges, fixates, and springs
also, maybe teaching the users to spawn it on existing geometries by using New Method
Jrv wrote:TC42 wrote:Quite honestly, I didn't think anyone on 4chan has that good a use of grammar, spelling, usage, mechanics, ect.
But I've never been there, so I may be wrong.
GTFO newfgt
-
RA2lover - Posts: 607
- Joined: Mon Aug 31, 2009 8:43 pm
- Location: Brazil
Re: How to spawn hinges, fixates, and springs
I would do that, but I don't really understand how you would use the "New Method."
-
standardtoaster - Posts: 606
- Joined: Mon Aug 31, 2009 7:57 pm
Re: How to spawn hinges, fixates, and springs
yep. all the time i wondered why the hell this method is working or how it's working
-
KarateBrot - Posts: 825
- Joined: Mon Aug 31, 2009 7:32 pm
- Location: Germany
Re: How to spawn hinges, fixates, and springs
looks like its a glitch exploitation.
when you use app.step, you do a scene minisave. app.undo deletes it, and those parameters'acessing is still marked last time.
not sure if algoryx will allow it to be official.
when you use app.step, you do a scene minisave. app.undo deletes it, and those parameters'acessing is still marked last time.
not sure if algoryx will allow it to be official.
Jrv wrote:TC42 wrote:Quite honestly, I didn't think anyone on 4chan has that good a use of grammar, spelling, usage, mechanics, ect.
But I've never been there, so I may be wrong.
GTFO newfgt
-
RA2lover - Posts: 607
- Joined: Mon Aug 31, 2009 8:43 pm
- Location: Brazil
Re: How to spawn hinges, fixates, and springs
Well, if it might not always be there I won't add it.
-
standardtoaster - Posts: 606
- Joined: Mon Aug 31, 2009 7:57 pm
Re: How to spawn hinges, fixates, and springs
Well, but can I spawn hinges without ID , like when i use hinge tool , it will read pos, look what object is there and connect it with lower one?
-
Nait - Posts: 224
- Joined: Fri Oct 30, 2009 1:56 am
- Location: Eastern Russia, Vladivostok
Re: How to spawn hinges, fixates, and springs
Sadly, no. You have to give the geom1 and geom0 otherwise you will get:
Edit: Added stuff about the console and whatnot.
- Code: Select all
!! ERROR: Constraint connected to unknown geometry
Edit: Added stuff about the console and whatnot.
-
standardtoaster - Posts: 606
- Joined: Mon Aug 31, 2009 7:57 pm
Re: How to spawn hinges, fixates, and springs
whats this "new method"?
link please
btw nice tut
link please
btw nice tut
http://www.speedtest.net/result/546516101.png
EAT THAT LOWLOL ( now ivanlul)! ALMOST DOUBLE YOUR DL SPEED! - HAVE FASTEST INTERNET SPEED IN FORUMS! w00t!
I was on the old forums aswell
I cant be a Phundamentalist because Im crap at algodoo.
"Every cloud has silver lining. Except the mushroom shaped ones, which have a lining of Iridium and Strontium 90."- Kevin Holmes
EAT THAT LOWLOL ( now ivanlul)! ALMOST DOUBLE YOUR DL SPEED! - HAVE FASTEST INTERNET SPEED IN FORUMS! w00t!
I was on the old forums aswell
I cant be a Phundamentalist because Im crap at algodoo.
"Every cloud has silver lining. Except the mushroom shaped ones, which have a lining of Iridium and Strontium 90."- Kevin Holmes
- Altro
- Posts: 94
- Joined: Mon Aug 31, 2009 5:56 pm
Re: How to spawn hinges, fixates, and springs
How hard is it to search?
viewtopic.php?f=13&t=545
viewtopic.php?f=13&t=545
Millions of voices suddenly cried out in terror, and were suddenly silenced. Something terrible has happened.
-
RicH - [Funniest Person 2010]
- Posts: 2043
- Joined: Tue Sep 01, 2009 9:01 am
Re: How to spawn hinges, fixates, and springs
lol, if that would be true, attaching tracers to existing objects would be impossible.
Jrv wrote:TC42 wrote:Quite honestly, I didn't think anyone on 4chan has that good a use of grammar, spelling, usage, mechanics, ect.
But I've never been there, so I may be wrong.
GTFO newfgt
-
RA2lover - Posts: 607
- Joined: Mon Aug 31, 2009 8:43 pm
- Location: Brazil
Re: How to spawn hinges, fixates, and springs
How so? Spawning a pen doesn't require a geomID.
-
standardtoaster - Posts: 606
- Joined: Mon Aug 31, 2009 7:57 pm
Re: How to spawn hinges, fixates, and springs
Great discovery - if I have a spawner, it forgotts that old object has the same ID and works with the last one!
-
Nait - Posts: 224
- Joined: Fri Oct 30, 2009 1:56 am
- Location: Eastern Russia, Vladivostok
Re: How to spawn hinges, fixates, and springs
Thanks! I never did understand why you can spawn multiple objects with the same ID.
-
standardtoaster - Posts: 606
- Joined: Mon Aug 31, 2009 7:57 pm
Re: How to spawn hinges, fixates, and springs
Never mind, I'm ve-e-e-e-e-ery clever
-
Nait - Posts: 224
- Joined: Fri Oct 30, 2009 1:56 am
- Location: Eastern Russia, Vladivostok
Re: How to spawn hinges, fixates, and springs
*Sorry for the bump*
Great tutorial! I especially like your use of diagrams. You've explained it pretty well because I never understood this, but now I do...
Great tutorial! I especially like your use of diagrams. You've explained it pretty well because I never understood this, but now I do...
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: How to spawn hinges, fixates, and springs
Can someone educated tell me if there are any negative consequences of spawning multiple objects with the same ID?
Phundamentalist
-
davidz40 - Posts: 438
- Joined: Sun Sep 06, 2009 10:30 am
Re: How to spawn hinges, fixates, and springs
Can i spawn a fixate with only 1 ID?
-
FuzzyLogicBrain - Posts: 315
- Joined: Mon Jan 31, 2011 7:48 pm
- Location: when online, on the computer. when not, probably on it anyways. ;D lulz
Re: How to spawn hinges, fixates, and springs
Nait wrote:Well, but can I spawn hinges without ID , like when i use hinge tool , it will read pos, look what object is there and connect it with lower one?
Ive tried it. If you give the proper coordinates to 2 objects overlapping, a hinge will appear. At least on phun beta 5. I dont know about algodoo though.
My signature is worth a lot of money, So I'm gonna put this stamp instead:
[$20 PER AUTOGRAPH]
[$20 PER AUTOGRAPH]
- racergonemad
- Posts: 26
- Joined: Tue Aug 17, 2010 7:37 am
Re: How to spawn hinges, fixates, and springs
Can someone tell me if their a way to spawn a hinge that has keyboard controls?
And whats up with the wierd motorSpeed property for spawned hinges. Like if I put scene.addHinge({motorSpeed := 10}) ill get a motor speed of 95 instead.
Great Tutorial BTW
And whats up with the wierd motorSpeed property for spawned hinges. Like if I put scene.addHinge({motorSpeed := 10}) ill get a motor speed of 95 instead.
Great Tutorial BTW
My signature is worth a lot of money, So I'm gonna put this stamp instead:
[$20 PER AUTOGRAPH]
[$20 PER AUTOGRAPH]
- racergonemad
- Posts: 26
- Joined: Tue Aug 17, 2010 7:37 am
Re: How to spawn hinges, fixates, and springs
motorSpeed is probably in radians/second. Not rotations/minute.
And was the bump really, completely necessary?
Maybe... Very useful tutorial.
And was the bump really, completely necessary?
Maybe... Very useful tutorial.
Matthias Wandel is epic, in my humble opinion.
I love my brain...
ARE YA HAPPY NOW?????
Thymechanic/Phundamentalist
Recently, I discovered something a lot of you probably already knew: Minecraft is awesome.
Due to this, I may not be as active as usual for a while.
I love my brain...
TC42 wrote:Also, your sig is too big, please change it.
ARE YA HAPPY NOW?????
Thymechanic/Phundamentalist
Recently, I discovered something a lot of you probably already knew: Minecraft is awesome.
Due to this, I may not be as active as usual for a while.
-
Someone Else - Posts: 1147
- Joined: Sun Nov 21, 2010 10:53 pm
- Location: The Milky Way Galaxy
Re: How to spawn hinges, fixates, and springs
Someone Else wrote:...And was the bump really, completely necessary?...
As long as it is on topic.
Though it's a old tutorial it still works. Shame that new method was removed...
make sure to check out my work.
-
Rideg - Posts: 948
- Joined: Tue Dec 15, 2009 5:17 pm
- Location: Östersund, Sweden
33 posts • Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 2 guests