Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Anyone got an idea for a variable offset/distance from an avatar?

Grazel Cosmo
Registered User
Join date: 12 Mar 2005
Posts: 28
08-13-2006 15:35
You can have child prims show/hide using link message, they don't have to be seperate objects. You could also simulat leg movement using a texture with the leg 'frames' and just hav the texture offset cycle through them.

As for movement I thought MoveToTarget was based on force and energy available so it should be possible to prevent instant movement and even provide variable speeds for 'slow' effects and such.

I've not worked with phsyics much but one way to keep it on the ground is to put a flat prim on its bottom that you call llSetPos() on to just pushing it to -100z or something since llSetPos() will not put a prim under the ground level and instead will stop with the center of the prim at ground level.
Eaglebird Cameron
YTMND *********
Join date: 1 Jul 2006
Posts: 68
08-13-2006 16:28
From: Grazel Cosmo
You can have child prims show/hide using link message, they don't have to be seperate objects. You could also simulat leg movement using a texture with the leg 'frames' and just hav the texture offset cycle through them.

That's what I was thinking of last night before bed :P

From: someone
As for movement I thought MoveToTarget was based on force and energy available so it should be possible to prevent instant movement and even provide variable speeds for 'slow' effects and such.


It's set up for llMoveToTarget(vector pos, float tau);. That means I have a target, and I move to it, no matter how far away, in tau seconds.

From: someone
I've not worked with phsyics much but one way to keep it on the ground is to put a flat prim on its bottom that you call llSetPos() on to just pushing it to -100z or something since llSetPos() will not put a prim under the ground level and instead will stop with the center of the prim at ground level.

I don't want that bumpy and possibly tipping movement related to physics + ground, at least what I've seen happen so far, and set pos would be choppy for what I'm trying to achieve.
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
08-13-2006 16:55
From: Eaglebird Cameron
I've also found a problem with llMovetoTarget.
The float tau, seconds.
It means 1 = 1 second all the time. If I'm all the way across the sim, I can cross it in 1 second. If I've got .01m to move, it takes me one second to move there.

I'm guessing a time distance formula used to calculate how long it should take the object to move x distance would be needed, but I don't know exactly how to implement it.

Get the vector between your current position and the destination (attackpos - llGetPos()), then measure its length with llVecMag() ... then use this value for your Tau parameter. This will cause your monster move with speed of 1 m/sec. If you want it to move faster or slower, multiply value returned by llVecMag() by less or more than 1.0
Eaglebird Cameron
YTMND *********
Join date: 1 Jul 2006
Posts: 68
08-14-2006 00:40
I added this to keep the monster on the ground
CODE

if(dist > 14)
//If the monster is out of attack range
{
//Then do this:
float ground = llGround(currentpos);
ground = ground + 0.1;
//Done to keep a small clearance on ground. Monster is floating, though looks close enough to the ground.
scale = (dist - 13.5) / dist;
attackpos = currentpos + (offset * scale);
//Determine move distance
llMoveToTarget(<attackpos.x,attackpos.y,ground>, 1);
//Move there
}

That's just a snippet from my if else statements.
That 0.1 float addition doesn't seem to work, I'm going to try a .2 or .5 and see if it's just the distance or if it won't work at all.

Nope. That right there seems to screw up rotation. It'll move alright, into the correct position, but it doesn't rotate around to face the avatar.
1 2