Jump to content

Animesh Follows Path


EnCore Mayne
 Share

You are about to reply to a thread that has been inactive for 588 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

is there any way to import an animesh that follows a path in Blender into Second Life?

1. i've got a customized mesh weighted and animated to the tail bones of the avatar skeleton using Avastar.
2. i've got that animated mesh following a circular path in Blender.

how do i get the mesh object out of Blender with the circular path?

Link to comment
Share on other sites

6 hours ago, EnCore Mayne said:

is there any way to import an animesh that follows a path in Blender into Second Life?

1. i've got a customized mesh weighted and animated to the tail bones of the avatar skeleton using Avastar.
2. i've got that animated mesh following a circular path in Blender.

how do i get the mesh object out of Blender with the circular path?

Export that animation 😉

The thing is that you will need a script to trigger the start play animation once you uploaded both mesh and animation

Link to comment
Share on other sites

yeah, i wish it was that easy, Optimo. i know how to set up the animesh inworld. the problem is converting the follow circular path into the existing animation. in other words, the mesh (a fish body) is animated to simulate a swimming animation. all well and good. that actually works when i bring it inworld. however, i want the swimming mesh body to follow a circular path (just like it appears in Blender).

i've tried selecting the bones then Object>Animation>Bake Action (which writes keyframes every frame of the 100 frame animation) but that animation export doesn't translate the circular follow.

i'm not sure what i'm doing. just trying to follow as many tutorials as i can find but there's really too many moving parts for me to get me head around. is it indeed possible?

Link to comment
Share on other sites

How are you moving the entire skeleton? Are you keyframing the armature itself in Object Mode or the mPelvis bone in Pose Mode? Because only the second method will include the motion in the animation.

Also, if you're using Blender's own BVH export and you're using the default scale of "1" = 1 meter, you'll need to set a scale of 39.4 in the export options. SL is hardcoded to interpret all distances in BVH files as inches.

Link to comment
Share on other sites

That's the problem. You're moving the armature. Translations/rotations to the armature object don't go into the animation. You need to modify the mPelvis bone within the armature (or CoG in Avastar -- NOT Origin).

Here's what I had to do:

  • Don't put a Follow Path object constraint on the armature. Put a Follow Path bone constraint on CoG.
  • When you bake the animation (Pose -> Animation -> Bake Action...), turn on Only Selected Bones and Visual Keying. (You may or may not want to Clear Constraints, but if you don't, disable them so they don't re-apply post-bake.)
  • Bake the data to the Pose.

 

ADDENDUM: Something you need to watch for. Animesh animations can't move mPelvis more than 5 meters from its starting spot. Make sure your swimming circle isn't too big.

You will probably also get a one-time, permanent vertical displacement the first time you play an animation with a hip repositioning on an Animesh object. The system is really quirky like that.

Edited by Quarrel Kukulcan
  • Thanks 1
Link to comment
Share on other sites

thanks for the help Quarrel but i'm taking a different tack. i need that circular radius to be 20 or more meters. i'll try scripting the animesh model that actually works. i may revisit the follow path constraints at a later date. as it is, this method is way over my head.

Link to comment
Share on other sites

in the case anyone's wanting the script for an animesh to follow a circular movement i found one on the Kitely forums:

integer CHAN;
integer BOTCHAN = -123;
integer MARKERMAX = 8;//total number of markers
integer gMarkCount = 0;
vector  gTarget;
rotation gAngle;
rotation gRot;
rotation gRotOld;
float SPEED = 2.5; //smaller is faster

rotation f_rotDir(vector localAxisToPointWith, vector target, vector origin)
{   
     return llRotBetween(localAxisToPointWith*ZERO_ROTATION, target-origin);
}

SFrame(vector pos,rotation rot, float seconds)
{
//From Kayaker Magic
        llSetKeyframedMotion([pos-llGetPos(),rot/llGetRot(),seconds],
            [KFM_MODE,KFM_FORWARD,KFM_DATA,KFM_TRANSLATION|KFM_ROTATION]);
}

default
{
    state_entry()
    {
        llSetRot(ZERO_ROTATION);
        gRot = ZERO_ROTATION;
        llSensor("marker"+(string)gMarkCount, "", PASSIVE, 40.0, PI);
        llStartObjectAnimation( llGetInventoryName( INVENTORY_ANIMATION, 0) );
        CHAN = llListen(BOTCHAN, "", NULL_KEY, "");
    }
    
    timer()
    {
        if (llVecDist(llGetPos(), gTarget) < 1.0)//arrived
        {
            if (gMarkCount == MARKERMAX-1)
            {
                gMarkCount = 0;
            }
            else
            {
                gMarkCount++;
            }
            llSensor("marker"+(string)gMarkCount, "", PASSIVE, 40.0, PI);
        }
    }
        
    sensor(integer total_number)
    {    
        gTarget=llDetectedPos(0);
        llSetTimerEvent(1.0);
        gRot = llDetectedRot(0);
        float distance = llVecDist(llGetPos(), llDetectedPos(0));
        SFrame(llDetectedPos(0), gRot, distance*SPEED);
        gRotOld = gRot;
    }

    no_sensor()
    {
       //llDie();
       llOwnerSay("no new sensor");
    }
}

works a treat.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 588 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...