How to spawn hinges, fixates, and springs
33 posts • Page 2 of 2 • 1, 2
Re: How to spawn hinges, fixates, and springs
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
PS: I have to use a laser so I use the onHitbylaser script
-
PhunWars - Posts: 78
- Joined: Wed Dec 30, 2009 11:01 pm
Re: How to spawn hinges, fixates, and springs
Cool tutorials! 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?
- windtalkers
- Posts: 13
- Joined: Thu May 05, 2011 7:03 am
Re: How to spawn hinges, fixates, and springs
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.
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.
@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...
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
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
sorry for the bump
-
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
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?
-
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
No there is a fix joint. >:( Why is it so difficult to do something on algodoo?
-
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
Because Algodoo is a physics simulator, not a coding program.
TheWinkits wrote:They both looks of cuking amazing
-
Chronos - [Most Active Member 2010]
- Posts: 4457
- Joined: Mon Aug 31, 2009 6:00 pm
- Location: Californania
-
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
33 posts • Page 2 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 3 guests