Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Aligment of Objects

Demetrius Therian
Registered User
Join date: 4 Jun 2004
Posts: 14
06-06-2004 12:05
Imagine that I could select 3 objects, and have them snap align to any one axis.

Example : Building a wall, I create 3 objects, group select them and say Aling along X Axis, and BAM there they are , in a perfect line.

Doable ?
Siobhan Taylor
Nemesis
Join date: 13 Aug 2003
Posts: 5,476
06-06-2004 15:20
Tools > Show Grid
Tools > Grid Options

You'll have to do each individually, but you can do it.

But better still... use the drag-copy method of creating and they'll be lined up from the start. Or use the numbers in the edit box's object tab, for millimetre accuracy.
_____________________
http://siobhantaylor.wordpress.com/
Artillo Fredericks
Friendly Orange Demon
Join date: 1 Jun 2004
Posts: 1,327
06-07-2004 13:24
Well, I certainly understand the usefulness of the grid/snap functions, but I can see where something like a face-snap function would be highly useful. I was making some tube shapes just last night and rotating them in all sorts of directions and at funky angles, and it would be great if I could just tell the thing to snap face-face between the two tubes so that they aligned correctly. Most parametric CAD programs have functions similar to this, not sure how easy it would be to implement in SL though, but definitely would be useful! ... also along the same "lines" (pardon the pun) alignment to centerline axis of tubes/cylinders/cones (would be useful for wheels/axles n such), edge-edge alignment (without resorting to coordinate maths), perpendicular and tangent alignments on spherical shapes would be nice too :)

Peace,

Artillo

JUST SAY NO TO GAPS/FLASHING! LOL
Demetrius Therian
Registered User
Join date: 4 Jun 2004
Posts: 14
06-11-2004 11:17
From: someone
Originally posted by Siobhan Taylor
Tools > Show Grid
Tools > Grid Options

You'll have to do each individually, but you can do it.

But better still... use the drag-copy method of creating and they'll be lined up from the start. Or use the numbers in the edit box's object tab, for millimetre accuracy.


That's exactly what I ended up doing, thanks to some guidance from my mentor.

Onward!
Demetrius Therian
Registered User
Join date: 4 Jun 2004
Posts: 14
06-11-2004 11:17
From: someone
Originally posted by Artillo Fredericks

JUST SAY NO TO GAPS/FLASHING! LOL


You know it!
forestrock Flower
insignificant rock
Join date: 14 Nov 2003
Posts: 120
06-11-2004 11:46
Actually there are 2 axis of object alignment... one is evil, neutral, good and the other is chaos, neutral, law. A Lawfully good object....

*forestrock crawls back in his geek cave*
Eggy Lippmann
Wiktator
Join date: 1 May 2003
Posts: 7,939
06-11-2004 12:13
I am Chaotic Good. You?
forestrock Flower
insignificant rock
Join date: 14 Nov 2003
Posts: 120
06-11-2004 14:02
I think I'm neutral good... though I'm easily charmed by bad people.
Reitsuki Kojima
Witchhunter
Join date: 27 Jan 2004
Posts: 5,328
06-11-2004 14:07
Neutral/Neutral.

However, I'm rather partial to the Warhammer setting, where Law/Chaos is the only axis one needs to care 'bout...

Ok, the joke has run long enough :)
Oz Spade
ReadsNoPostLongerThanHand
Join date: 23 Sep 2003
Posts: 2,708
06-11-2004 19:22
A snap to object would be handy, but should be toggable as alot of times it would annoy me.

Often times I've wanted a "Line This Object up With This One" feature. Grid doesn't work because I don't start my builds by grid, and then using them later or moving them is just, ugh. :P

I endorse this idea/feature.
_____________________
"Don't anticipate outcome," the man said. "Await the unfolding of events. Remain in the moment." - Konrad
Darwin Appleby
I Was Beaten With Satan
Join date: 14 Mar 2003
Posts: 2,779
06-11-2004 20:28
I'm good... IN BED!

I'm mature. Oh, so mature.
_____________________
Touche.
Eggy Lippmann
Wiktator
Join date: 1 May 2003
Posts: 7,939
06-12-2004 04:48
This has been done in scripting... I suggested "magnetic alignment" way back in beta or so, and philip coded up some magic blocks that snapped together. Dont know if they are still around, but i have a copy of them.
Tiger Crossing
The Prim Maker
Join date: 18 Aug 2003
Posts: 1,560
06-12-2004 09:31
An alignment pallet like those found in many graphic layout programs would be nice. A ton of possibilities there that would be DAMN useful.
_____________________
~ Tiger Crossing
~ (Nonsanity)
Denny Giles
Registered User
Join date: 5 Dec 2005
Posts: 2
01-02-2006 22:10
Tiger: Exactly. Not just alignment, but distribution - like when you are trying to space out posts along a railing, or stairs.
SuezanneC Baskerville
Forums Rock!
Join date: 22 Dec 2003
Posts: 14,229
01-02-2006 22:27
There's the code from what is most likely the magic blocks Eggy mentioned. Might be a start, I doubt it takes object shape, skew , etc. into account.

CODE
vector pos; 
vector found_pos;
vector start_touch_pos;
vector diff;
vector scale;
string name_detected;

vector PULSE_COLOR = <1,1,1>;

float GRAB_ALPHA = 0.5;
float INC = 2.0; // Grid spacing for snap, scale
float MAX_INC = 2.5; // Biggest dimension

list colors = [<1,0,0>, <0,1,0>, <0,0,1>,
<0,1,1>, <1,0,1>, <1,1,0>];

//list tones = ["piano_1", "piano_3", "piano_5"];

vector color;
integer color_index = 0;

integer CHANNEL = 3442;
integer pulse = FALSE;
integer inhibit = FALSE;
float INHIBIT_DELAY = 1.0;
float DECAY_FACTOR = 0.9;

send_pulse()
{
// Change color briefly and transmit a neural 'pulse'
inhibit = TRUE;
llSetTimerEvent(INHIBIT_DELAY);
//integer tone = llRound(llFrand((float)(llGetListLength(tones) - 1)));
//llTriggerSound(llList2String(tones, tone), 1.0);
llSetColor(PULSE_COLOR, ALL_SIDES);
llSay(CHANNEL, "pulse");
}

vector vec_round(vector vec, float inc)
{
// Rounds vector components to the nearest units of inc
vec *= 1.0/inc;
vec.x = ((float)llRound(vec.x));
vec.y = ((float)llRound(vec.y));
vec.z = ((float)llRound(vec.z));
vec *= inc;
return vec;
}

set_pos()
{
//
// On finding a neighbor, snap relative to neighbor
//
pos = llGetPos();
llSetColor(color*0.5, ALL_SIDES);
diff = pos - found_pos;
diff = vec_round(diff, INC/2.0);
diff += found_pos;
llSetPos(diff);
llTriggerSound("on", 1.0);
llSetColor(color, ALL_SIDES);
}

vector new_color()
{
integer num_colors = llGetListLength(colors);
color_index++;
if (color_index >= num_colors) color_index = 0;
return llList2Vector(colors, color_index);
}

snap()
{
// Issues the sensor to look for nearby blocks to snap to
float range = 10.0;
llSensor("Magic Block", "", PASSIVE | SCRIPTED, range, 2.0*PI);
}

default
{
state_entry()
{
scale = llGetScale();
color = new_color();
llSetColor(color, ALL_SIDES);
llSetStatus(STATUS_BLOCK_GRAB, FALSE);
llSetBuoyancy(1.0);
llListen(CHANNEL, "", "", "pulse");
}

on_rez(integer param)
{
found_pos = llGetPos();
set_pos();
snap();
}

timer()
{
llSetTimerEvent(0.0);
inhibit = FALSE;
llSetColor(color, ALL_SIDES);
}

changed(integer change)
{
if (change == CHANGED_SCALE)
{
scale = llGetScale();
scale = vec_round(scale, INC);
if (scale.x == 0.0) scale.x = INC;
if (scale.y == 0.0) scale.y = INC;
if (scale.z == 0.0) scale.z = INC;
if (scale.x > MAX_INC) scale.x = MAX_INC;
if (scale.y > MAX_INC) scale.y = MAX_INC;
if (scale.z > MAX_INC) scale.z = MAX_INC;
llSay(0, "new scale = " + (string)scale);
llSetScale(scale);
// Choose a new color for the block
snap();
}
}

touch_start(integer total_number)
{
start_touch_pos = llGetPos();
llSetAlpha(GRAB_ALPHA, ALL_SIDES);
llTriggerSound("on", 1.0);
llResetTime();
llSetStatus(STATUS_PHYSICS, FALSE);
}
touch_end(integer total_number)
{
llSetStatus(STATUS_PHYSICS, FALSE);
llSetAlpha(1.0, ALL_SIDES);
vector moved = llGetPos() - start_touch_pos;

if (llGetTime() < 0.3)
{
// Cycle colors on short click
llSetPos(start_touch_pos);
llTriggerSound("color", 1.0);
color = new_color();
llSetColor(color, ALL_SIDES);
}
else if (llVecMag(moved) < (INC/10.0))
{
llSetPos(start_touch_pos);
send_pulse();
}
else
{
// Try to find a block to stick to!
llSetColor(color, ALL_SIDES);
snap();
}
llSetRot(<0,0,0,1>);
}

listen(integer channel, string name, key id, string message)
{
// Received neural pulse, so sense sender's distance
if (!inhibit)
{
pulse = TRUE;
llSensor("", id, PASSIVE | SCRIPTED, 10.0, 2.0*PI);
}
}

no_sensor()
{
pulse = FALSE;
}
sensor(integer num_detected)
{
if (!pulse)
{
//
// Rotate/snap to nearest box
//
// Issue scale request to this box
//
found_pos = llDetectedPos(0);
set_pos();
}
else
{
//
// Gauge distance to nearest box, decide whether to 'fire'
//
pulse = FALSE;
pos = llGetPos();
found_pos = llDetectedPos(0);
diff = pos - found_pos;
// probability of neural firing is related to distance
float distance = llVecMag(diff);
if (distance > 0.0)
{
if (llFrand(1.0) < ((INC/(distance*distance))*DECAY_FACTOR))
{
send_pulse();
}
}
}
}
}
_____________________
-

So long to these forums, the vBulletin forums that used to be at forums.secondlife.com. I will miss them.

I can be found on the web by searching for "SuezanneC Baskerville", or go to

http://www.google.com/profiles/suezanne

-

http://lindenlab.tribe.net/ created on 11/19/03.

Members: Ben, Catherine, Colin, Cory, Dan, Doug, Jim, Philip, Phoenix, Richard,
Robin, and Ryan

-