Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

kinetic sculpture

Ben Culcomp
Registered User
Join date: 21 Aug 2005
Posts: 4
08-21-2005 08:20
I'm relatively new at SL so this might be an easy answer.

I'm building a kinetic sculpture which at the moment consists of a hollow spiral ring, that I am rotating slowly. I want to put balls inside it and have them roll around, with 'physics', as the spiral rotates. When I place a ball it works for about 2 seconds, until the ball comes to a resting place (the spiral takes about 90 sec to make a full rotation). Then the ball stays frozen in the air while the spiral spins through it.

What has happened? The ball keeps passing through the wall of the spiral and I can't get it to start 'colliding' again unless I turn the balls Physics off/on again.

fyi: the ball is 20cm in diameter and the spiral is about 3 meters across, the diameter of the hollow tube being about 35+cm.

any help would be greatly appreciated!
Jesrad Seraph
Nonsense
Join date: 11 Dec 2004
Posts: 1,463
08-21-2005 10:17
I clicked on this thread thinking it was about kinetic sculpture races but naaaah :(
_____________________
Either Man can enjoy universal freedom, or Man cannot. If it is possible then everyone can act freely if they don't stop anyone else from doing same. If it is not possible, then conflict will arise anyway so punch those that try to stop you. In conclusion the only strategy that wins in all cases is that of doing what you want against all adversity, as long as you respect that right in others.
Ardith Mifflin
Mecha Fiend
Join date: 5 Jun 2004
Posts: 1,416
08-21-2005 10:23
From: Jesrad Seraph
I clicked on this thread thinking it was about kinetic sculpture races but naaaah :(



Burning Life is coming up. Maybe we should have a kinetic sculpture race!
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
08-21-2005 10:26
How are you rotating the spiral?
_____________________
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
08-21-2005 10:26
Here are a few suggestions.

1. As a debug tool, try making the object say "collided" or something on every collision event. That way you'll get some idea of what's going on.

2. Are you re-applying impulses on collisions? Is it possible that your object just slows down and stops? If you're using collision_start, you'll only get that at the instant you touch something, not while you're siting touching something (AFAIK).

3. Try detecting when the object has stopped moving and push it so it starts moving again? An easy way would be to call llGetPos inside a timer and chek if the current pos is the same as the new pos. But if the ball is inside a moving spiral then this won't work. Maybe a variation - check if the new height is the same as the old height (assuming the ball's height doesn't change as the spiral rotates with a stuck ball)? You could also count it, so say if you get 5 consecutive clock ticks where the height stays the same, you can assume that it's stuck and kick the ball to make it move again. Or something like that.
Malachi Petunia
Gentle Miscreant
Join date: 21 Sep 2003
Posts: 3,414
08-21-2005 10:38
In my experience, the sizes you are using are way too small for the physics engine to calculate properly which will probably result in stuck balls or them falling through the container. I'd start with 1m spheres while experimenting, you can always shrink 'em once you get it working (until it stops working). Also of note is that the balls have mass proportional to the cube of the radius, so as they get smaller they are more likely to get hung-up on edges.

Out of consideration for your neighbors (and likely yourself) you might want to put the script
CODE
default {
state_entry() {
llCollisionSound("", 1);
}
}
into the prims as those "bonks" can get a little annoying.

You might also want to look at the non-physical kinematic functions as I've seen some great kinetic art made with those and they require much less compute resources and are way easier to control.

Have fun.
Ben Culcomp
Registered User
Join date: 21 Aug 2005
Posts: 4
08-21-2005 11:28
Jillian: I am rotating the spiral using llSetRot(llGetRot() * llEuler2Rot(<x,y,0>;)); where x and y are sin and cos values. I want the axis of the spiral to move but want the faces of the spiral to stay facing the same way. It is a single prim.

Ziggy Puff: I am thinking of putting debug messages, that is a good idea. I'm also going to try just a single tube, turned horizontally, with a ball inside. Tipping the tube like a seesaw should produce the same results I think. Perhaps I can isolate the problem. I tried putting in a little 'kick' in the ball every couple seconds but it would either (a) have no apparent effect or (b) eventually cause the ball to leap out of the spiral.
I'm not sure what you mean by "re-applying impulses on collision"? A kinetic sculpture takes advantage of "natural" phenomena (gravity in this case) so I am not doing any collision handling myself. Hopefully I won't have to.

Malachi: I think you might be right about the size of the whole thing. I know the sim can only resolve collisions to 0.1m but thought I was under that.

I thought I might be missing something - I know in other scripting languages you have to initiate the collision check and if you don't do it often enough things will pass through eachother. But it doesn't seem like that in SL, it should be on all the time right? So I guess the ball comes to rest, stops "colliding", and fails to notice that the spiral is trying to push it.
Should I turn on physics for the spiral? It doesn't seem to make a difference.

I will try making it very big and see what happens - thanks for the good ideas.
-Ben
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
08-21-2005 13:08
You should be using physics for the spiral, yes. Kinematic movement doesn't effect physical objects in any way you might expect from visial cues. And Malachi is also right, the small sizes aren't something the current physics engine handles well.

You'll be needing:

llMoveToTarget()
llSetTorque() or llApplyRotationalImpulse()
and llSetStatus(), particularly STATUS_ROTATE_*.
_____________________
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
08-21-2005 16:50
From: someone
A kinetic sculpture takes advantage of "natural" phenomena (gravity in this case) so I am not doing any collision handling myself. Hopefully I won't have to.


I see your point. And ideally you wouldn't have to. But sometimes physics engines need a little help :)

Good luck. This should be pretty cool once you're done with it.
Blain Candour
Registered User
Join date: 17 Jun 2005
Posts: 83
08-22-2005 08:49
Keep in mind also that physics is a bit of a drain on the sim. If you plan on putting multiple cureved bjects inside another curved object then having them all constantly colliding not only will it be unreliable but it will be a bit of a drain when left out. Kinetic sculptures are cool but I am not really sure SL is ready for them.
_____________________
DISCLAIMER: Blain Candour is a total and eternal n00b and everything he tells you should be taken with a huge pile of salt. Especially when he refers to himself in third person!
Stefan Nilsson
Registered User
Join date: 14 May 2005
Posts: 8
08-22-2005 10:57
See
http://secondlife.com/badgeo/wakka.php?wakka=precision

And try larger objects and/or more 'air' around them.
Ben Culcomp
Registered User
Join date: 21 Aug 2005
Posts: 4
08-22-2005 13:18
so the balls are colliding just fine, and I can keep them about .3m cubed. the trick seems to be to keep everything "physical" and apply rotational impulses to the coil to make it turn.

but now the coil wants to fall on the ground!
is there any way to build a non-physical base for the coil, or a physical one and then be able to turn the coil independently? the best might be to make the coil weightless - so it won't fall to the ground, but i don't want the little balls to be able to push it around either.

all my attempts so far have either the base rocking around (and slowly traveling) or the thing remaining frozen in place.

but at least the balls roll now!
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
08-22-2005 13:34
Set the buoyancy to 1 (or 0, I always forget which one to use) *before* turning the object's physics on. That'll keep it in place. Doing it in reverse order always makes the object drop a little as the script executes the "physics on" call and then the buoyancy call.

A physical object that's rotating will drift a little. One way around that is to use move to target with a hard damping. That'll lock the object in place, but allow it to rotate.

Someone else will probably give you better advice on this :) I've barely played with the physics engine, but I ran into similar issues the one time I tried to get a physical object to spin in one place.
Les White
sombish
Join date: 7 Oct 2004
Posts: 163
08-22-2005 13:51
vector pos = llGetPos();
float ground = llGround(ZERO_VECTOR);
float finalpos = pos.z - ground;
llSetHoverHeight(finalpos,FALSE,0.1);

this will keep it floating :)