|
Darian Llewellyn
Registered User
Join date: 9 Sep 2007
Posts: 1
|
10-22-2007 20:58
Ok, i'm trying to code to build a crankshaft with large weights replacing the pistons. I've run into a problem with making the piston rod interact with the crankshaft. How would i link/connect the two so they work properly? images for reference: http://www.grc.nasa.gov/WWW/K-12/airplane/Images/powert.gif <Labeled http://www.grc.nasa.gov/WWW/K-12/airplane/Images/cshaft.gif <Animated
|
|
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
|
10-22-2007 22:20
Since object linking in SL is strictly single-parent/one-or-more-children, a project like this gets tricky. You could build the crankshaft out of as many prims as necessary, so long as one of the "axle" prims was the root. Then put a script in the root containing an llTargetOmega call to make it rotate.
The pistons (or weights, in your case), however, would each have to be made up of a single prim, with their centers at the point of their contact with, and thus rotation about, the crankshaft. Then you put scripts in each of them with an llTargetOmega call causing them to rotate at the same speed as and in the opposite direction of the crankshaft.
Trigger them all at once (or, as close to "at once" as possible in SL) and if positioned correctly, the weights should generally appear to remain vertical as they revolve about their respective axes on the rotating crankshaft. How long the effect would hold, however, is another question entirely.
|
|
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
|
10-23-2007 12:24
You don't say whether you want to make a *working* crankshaft, or a simulation of one.
Deanna is describing the simulation approach. You make an axle and some pistons, and you script them all to move along as if they are driven by force and gravity. For the time being that might be your best bet.
The alternative is to make the pistons "physical", which in SL terms means they will be moved automagically by gravity. The problem with this approach is that physics in SL is computed by the old, old havok 1 physics engine, and is very rough and slow.
You can visit the beta grid to try out the new havok 4 engine, which looks very promising. Another thing to do is to search for Havok 4 on YouTube and look at some of the experiemtnst that have been posted there. There is a working set of gears, for example, and a cool hour glass with grains of sand pulled by the force of gravity.
This hour glass is a good example of how far the simulated physics engine still has to go. While a lot of the sand behaves correctly, a fair amount of it magically jumps outside the hour glass and ends up suspended in mid air.
To make a long story short, the laws of physics do not apply perfectly in SL, and they are about to change dramatically when havok 4 becomes standard.
|