Help in Killing Hinges

Post your tutorials here.

Help in Killing Hinges

Postby F22FA18FX14 » Wed Nov 21, 2012 9:25 am

How to make a killer in phun and how to make it delete only hinges it touches?
I try to stay away from scripting as i'm not ready for that yet.

I have Phun 5.28 or whatever it is. Just in case your wondering.
F22FA18FX14
 
Posts: 4
Joined: Wed Nov 21, 2012 9:14 am

Re: Help in Killing Hinges

Postby Kilinich » Wed Nov 21, 2012 9:51 am

"touch hinges" is impossible, it's not a geom.
You can script impulseLimit like this: {sim.time < 1 ? +inf : 0}
or make another geom between two hinged geoms so removing it will disconnect others.
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: Help in Killing Hinges

Postby F22FA18FX14 » Wed Nov 21, 2012 9:55 am

I don't understand what you're trying to say.
I mean it works like this: http://www.algodoo.com/algobox/details.php?id=58086

Something inside is making the "casings" fly out in pieces, not by a whole belt.

Sorry for the bad English, I'm French.
F22FA18FX14
 
Posts: 4
Joined: Wed Nov 21, 2012 9:14 am

Re: Help in Killing Hinges

Postby Kilinich » Wed Nov 21, 2012 1:44 pm

Make hinged geom disappear will remove hinge too.

Example: Geom1 - hinge - Geom2
You need to remove hinge if something pass through.

Add another geom between: Geom1 - hinge - Geom3 - fixate - Geom2
Now make it collide with some killer and hinge will disappear too.
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: Help in Killing Hinges

Postby Xray » Thu Nov 22, 2012 12:50 am

Kilinich wrote:"touch hinges" is impossible, it's not a geom.
You can script impulseLimit like this: {sim.time < 1 ? +inf : 0}
or make another geom between two hinged geoms so removing it will disconnect others.


Kilinich - Please explain in detail what impulseLimit is and how it can be used in a scene. I've never heard of that before.

Thanks
User avatar
Xray
 
Posts: 500
Joined: Sun Jun 17, 2012 6:12 am
Location: USA

Re: Help in Killing Hinges

Postby Xray » Thu Nov 22, 2012 3:39 am

F22FA18FX14 wrote:How to make a killer in phun and how to make it delete only hinges it touches?
I try to stay away from scripting as i'm not ready for that yet.

I have Phun 5.28 or whatever it is. Just in case your wondering.


Hello F22 -- There is a way that you can delete a hinge when one geometry touches another geometry, but it involves writing some very simple scripts. Writing script cannot be avoided for what you are trying to do. Here is how I discovered how to do it.

1. I opened the script menu of a hinge, and I wanted to see if there are any variables that I could set to zero or a negative number that would make the hinge become deleted from the scene, and I found one! There is a variable named "distanceLimit". I don't know what it's used for, but I discovered that when I set that variable to zero, the hinge becomes deleted from the scene!

2. I then realized that it's a simple matter to put a "scene.my" global variable in place of the value that's shown. I beleive that the value defaults to infinity, because that's what shows up there each time I put a hinge in a scene. So, I created a global variable named "scene.my.kill" and put it in place of the "inf". You must surround the variable with squiggly brackets.

3. I then created a very simple "onCollide" script in a circle that sets scene.my.kill to zero when the circle bumps into another object. When that happens, the hinge disappears from the scene, which I believe is what you want it to do. Here is the sample scene that I created for you. When you start Algodoo, you will see the hinge turning a circle, and when the ball hits the ground, the hinge will disappear.
Attachments
HINGE KILLER EXAMPLE.phz
(7.42 KiB) Downloaded 113 times
User avatar
Xray
 
Posts: 500
Joined: Sun Jun 17, 2012 6:12 am
Location: USA

Re: Help in Killing Hinges

Postby F22FA18FX14 » Sat Nov 24, 2012 6:15 pm

That's the kind of i'm looking for! Thanks!
F22FA18FX14
 
Posts: 4
Joined: Wed Nov 21, 2012 9:14 am


Return to Tutorials

Who is online

Users browsing this forum: No registered users and 4 guests

cron