How to spawn hinges, fixates, and springs

Post your tutorials here.

Re: How to spawn hinges, fixates, and springs

Postby PhunWars » Sun May 08, 2011 12:45 pm

But how can we do when we don't know the world position of an object ? For example I want to spawn a spring wich should be attached to the center of a square and to the plane which is down that square, but how can I do ?

PS: I have to use a laser so I use the onHitbylaser script
Image
User avatar
PhunWars
 
Posts: 78
Joined: Wed Dec 30, 2009 11:01 pm

Re: How to spawn hinges, fixates, and springs

Postby windtalkers » Sun May 08, 2011 2:31 pm

Cool tutorials! :clap: But how can I get the positions of the two circles, as world0pos := [-31.396013, 5.9814367]; world1pos := [-29.41792, 7.3022513] in your post? :crazy:
windtalkers
 
Posts: 13
Joined: Thu May 05, 2011 7:03 am

Re: How to spawn hinges, fixates, and springs

Postby Someone Else » Sun May 08, 2011 4:13 pm

Eh, I guess this bump was pretty well on-topic.

@PhunWars and windtalkers: Try these codes:

I use onCollide, so I will use the relevant codes here. The spawning code is the same as for lasers, though.

  • Make a circle.
  • A little ways below that, make an angled box.
  • A little ways below that, make another angled box, so the circle will bounce off the top one exactly once, then the bottom one exactly once.
  • Fixate both boxes to the background.
  • In the top box goes this code:
    Code: Select all
    scene.addCircle({
       pos := e.pos + [-10, 20];
       geomID := 1
    });
    scene.addCircle({
        pos := e.pos + [10, 20];
        geomID := 2
    })
  • In the bottom box goes this code:
    Code: Select all
    scene.addHinge({
       geom0 := 1;
       geom1 := 2;
       geom0pos := [0, 2];
       geom1pos := [0, -2];
       size = 1
    })

It spawns the hinge using geom0pos, the position relative to that geom's center of mass. Geom0pos := [0, 0] is the center of the object. Note that this code also spawns the hinge outside the objects.

NOTE: I learned this trick from Kilinich's hinge-spawn cursor.
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 FuzzyLogicBrain » Thu Sep 22, 2011 3:25 pm

well thats cool, but what if i want an obect to be spawned, with a fix joint, onto an existing object, becase i find the the geom id for the spawned object changes whether or not i state the geom id.
sorry for the bump
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 TC42 » Thu Sep 22, 2011 9:14 pm

Not possible, unfortunately. The geomID of the existing object will be subject to change, and if you don't have the geomID of the existing object, the fixate will be fixated between the background and the spawned object. Is this what is happening, or is no fixate spawning at all?
Image
Spambot wrote:Nowadays, memes usually are studied less in the field of biology, but more with the arena of psychology along with sociology. But, the major area of a meme, getting embraced and imitated all the time is what’s at any core connected with any meme.
User avatar
TC42
 
Posts: 984
Joined: Sun Jan 09, 2011 1:53 pm
Location: $ sudo apt get-install sandwich_

Re: How to spawn hinges, fixates, and springs

Postby FuzzyLogicBrain » Fri Sep 23, 2011 12:49 pm

No there is a fix joint. >:( Why is it so difficult to do something on algodoo?
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 Chronos » Mon Sep 26, 2011 5:02 pm

Because Algodoo is a physics simulator, not a coding program.
TheWinkits wrote:They both looks of cuking amazing
User avatar
Chronos
[Most Active Member 2010]
 
Posts: 4457
Joined: Mon Aug 31, 2009 6:00 pm
Location: Californania

Re: How to spawn hinges, fixates, and springs

Postby FuzzyLogicBrain » Mon Sep 26, 2011 5:34 pm

I don't code.
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

Previous

Return to Tutorials

Who is online

Users browsing this forum: No registered users and 2 guests

cron