How to spawn hinges, fixates, and springs

Post your tutorials here.

How to spawn hinges, fixates, and springs

Postby standardtoaster » Wed Oct 21, 2009 12:32 am

Spawning hinges, fixates, or springs is actually quite easy. :D

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:
Image

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:
Image

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:
Image

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)
Image

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:
Image
Last edited by standardtoaster on Sat Oct 31, 2009 11:58 pm, edited 2 times in total.
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: How to spawn hinges, fixates, and springs

Postby niffirg1 » Wed Oct 21, 2009 3:49 am

Wow this is amazing
Did not know how to do this until now
User avatar
niffirg1
 
Posts: 376
Joined: Mon Aug 31, 2009 10:31 pm
Location: The Great American South!

Re: How to spawn hinges, fixates, and springs

Postby KarateBrot » Wed Oct 21, 2009 6:16 am

Cool tutorial. I like tutorials with images :thumbup:
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.
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany

Re: How to spawn hinges, fixates, and springs

Postby standardtoaster » Wed Oct 21, 2009 7:37 am

Right, I forgot about that. :lol: I'll edit that next week or so.
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: How to spawn hinges, fixates, and springs

Postby RA2lover » Wed Oct 21, 2009 7:24 pm

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
User avatar
RA2lover
 
Posts: 607
Joined: Mon Aug 31, 2009 8:43 pm
Location: Brazil

Re: How to spawn hinges, fixates, and springs

Postby standardtoaster » Tue Oct 27, 2009 1:37 am

I would do that, but I don't really understand how you would use the "New Method."
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: How to spawn hinges, fixates, and springs

Postby KarateBrot » Tue Oct 27, 2009 4:20 am

yep. all the time i wondered why the hell this method is working or how it's working :wtf:
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany

Re: How to spawn hinges, fixates, and springs

Postby RA2lover » Thu Oct 29, 2009 6:14 pm

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.
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
User avatar
RA2lover
 
Posts: 607
Joined: Mon Aug 31, 2009 8:43 pm
Location: Brazil

Re: How to spawn hinges, fixates, and springs

Postby standardtoaster » Thu Oct 29, 2009 6:23 pm

Well, if it might not always be there I won't add it.
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: How to spawn hinges, fixates, and springs

Postby Nait » Fri Oct 30, 2009 2:59 am

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? :?:
User avatar
Nait
 
Posts: 224
Joined: Fri Oct 30, 2009 1:56 am
Location: Eastern Russia, Vladivostok

Re: How to spawn hinges, fixates, and springs

Postby standardtoaster » Fri Oct 30, 2009 3:52 am

Sadly, no. You have to give the geom1 and geom0 otherwise you will get:
Code: Select all
!! ERROR: Constraint connected to unknown geometry


Edit: Added stuff about the console and whatnot.
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: How to spawn hinges, fixates, and springs

Postby Altro » Sun Nov 01, 2009 11:20 pm

whats this "new method"?
link please

btw nice tut :thumbup:
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
Altro
 
Posts: 94
Joined: Mon Aug 31, 2009 5:56 pm

Re: How to spawn hinges, fixates, and springs

Postby RicH » Mon Nov 02, 2009 2:48 am

How hard is it to search?
viewtopic.php?f=13&t=545
Millions of voices suddenly cried out in terror, and were suddenly silenced. Something terrible has happened.
User avatar
RicH
[Funniest Person 2010]
 
Posts: 2043
Joined: Tue Sep 01, 2009 9:01 am

Re: How to spawn hinges, fixates, and springs

Postby RA2lover » Sat Nov 07, 2009 1:54 am

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
User avatar
RA2lover
 
Posts: 607
Joined: Mon Aug 31, 2009 8:43 pm
Location: Brazil

Re: How to spawn hinges, fixates, and springs

Postby standardtoaster » Sat Nov 07, 2009 1:56 am

How so? Spawning a pen doesn't require a geomID. :|
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: How to spawn hinges, fixates, and springs

Postby Nait » Mon Nov 09, 2009 4:28 am

Great discovery - if I have a spawner, it forgotts that old object has the same ID and works with the last one!
User avatar
Nait
 
Posts: 224
Joined: Fri Oct 30, 2009 1:56 am
Location: Eastern Russia, Vladivostok

Re: How to spawn hinges, fixates, and springs

Postby standardtoaster » Mon Nov 09, 2009 4:41 am

Thanks! I never did understand why you can spawn multiple objects with the same ID. :|
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: How to spawn hinges, fixates, and springs

Postby Nait » Tue Nov 10, 2009 2:19 pm

Never mind, I'm ve-e-e-e-e-ery clever ;)
User avatar
Nait
 
Posts: 224
Joined: Fri Oct 30, 2009 1:56 am
Location: Eastern Russia, Vladivostok

Re: How to spawn hinges, fixates, and springs

Postby Rrobba » Thu Apr 15, 2010 6:42 pm

*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...
Image
I don't suffer from insanity. I enjoy every minute of it.
User avatar
Rrobba
[Best Sig 2010]
 
Posts: 1480
Joined: Mon Aug 31, 2009 6:01 pm
Location: Gibraltar

Re: How to spawn hinges, fixates, and springs

Postby davidz40 » Sat May 29, 2010 8:14 pm

Can someone educated tell me if there are any negative consequences of spawning multiple objects with the same ID?
Phundamentalist
User avatar
davidz40
 
Posts: 438
Joined: Sun Sep 06, 2009 10:30 am

Re: How to spawn hinges, fixates, and springs

Postby FuzzyLogicBrain » Tue Feb 01, 2011 3:59 pm

Can i spawn a fixate with only 1 ID?
Image
these guys are awesome. <- full stop
User avatar
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

Postby racergonemad » Fri Mar 04, 2011 6:39 am

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]
racergonemad
 
Posts: 26
Joined: Tue Aug 17, 2010 7:37 am

Re: How to spawn hinges, fixates, and springs

Postby racergonemad » Fri Mar 04, 2011 6:49 am

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 :clap:
My signature is worth a lot of money, So I'm gonna put this stamp instead:
[$20 PER AUTOGRAPH]
racergonemad
 
Posts: 26
Joined: Tue Aug 17, 2010 7:37 am

Re: How to spawn hinges, fixates, and springs

Postby Someone Else » Fri Mar 04, 2011 3:33 pm

motorSpeed is probably in radians/second. Not rotations/minute.

And was the bump really, completely necessary?
Maybe... Very useful tutorial. :thumbup:
Matthias Wandel is epic, in my humble opinion.
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.
User avatar
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

Postby Rideg » Sat Mar 12, 2011 5:03 pm

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...
Image
make sure to check out my work.
User avatar
Rideg
 
Posts: 948
Joined: Tue Dec 15, 2009 5:17 pm
Location: Östersund, Sweden

Next

Return to Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest

cron