Mocap /redlinks

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

brunomartelli

New Member
Anyone know about using mocap?

We are using some, (and it looks great) but we have this problem, I believe to do with the Root Zero. When we swap from one mocap sequence to another the mocap jumps.

This seems to be because the mocap movement goes away from the zero point of the character.

We are trying to find out how to get the zero point to move with the motion to the end point of the mocap sequence, so we can seamlessly swap sequences. I think this info is in the UDN 'redlinks'. But we can't access the 'redlinks' and emails to Unreal are to no avail. We are artists not a commercial company so can afford licence.

regards

bruno
 

Switch`

Pixelante
Feb 27, 2004
98
0
0
Could you give us more details about the animations:
  • Do they all start in the zero point?
  • In which point do they end - 0 or somewhere else?
  • Do they need accurate collision?
  • On what kind of object will they be used: players, decorations, etc?
 

brunomartelli

New Member
mocap zero

yes,
all start on the zero, but some end elswhere, they don't need collision really. They are on players and on NPC's. So what happens is for example our animation on a player character replaces the 'idle' anim but maybe 1750 frames long, the performer moves around, turns etc, takes a step to left. This can be made as a loop no problem. But when the user presses W to move forward and the animation switches to our 'run' animation it jumps over to where the run anim starts from, the zero point

regards

bruno



Switch` said:
Could you give us more details about the animations:
  • Do they all start in the zero point?
  • In which point do they end - 0 or somewhere else?
  • Do they need accurate collision?
  • On what kind of object will they be used: players, decorations, etc?
 

Switch`

Pixelante
Feb 27, 2004
98
0
0
I'd try implementing basic root motion physics, where animation controls the object movement.

You can find some interesting ideas in this thread: http://forums.beyondunreal.com/showthread.php?t=145233&highlight=root+motion

There's also the LockRootMotion(1) function.
It makes the animation look as if the root wasn't moving at all, but you can still get the root location or offset with GetRootLocation() & GetRootLocationDelta() and move the animated object manually in each frame.

With this method to eliminate the skipping you'd have to reset the root offset at the first frame of new animation, so it's not calculated from two different anims. This method can't handle tweening of such anims without special case code. I haven't tested it with Channel Blending yet.

I'll post later example with LockRootMotion().
 
Last edited:

Switch`

Pixelante
Feb 27, 2004
98
0
0
Here's one way to do it:

Code:
class RMDummy extends Actor;

var MeshAnimation   Anim;           // anim object

var name            ANIM_Wander;    // anim names
var name            ANIM_Idle;      //
var name            ANIM_Move;      //
var name            ANIM_Next;      //

var int             RootCountdown;  //
var bool            bRootReset;     //


event PostBeginPlay()
{
    // cancel summon rotation
    SetRotation( default.Rotation );    

    // setup mesh & anim
    LinkMesh( default.mesh );
    LinkSkelAnim( default.Anim );
    LockRootMotion(1);

    PlaySomeAnim();
}

event Tick( float DeltaTime )
{
    local vector RootDelta;

    // another call to GRLD() will result in zero offset
    if( bRootReset && --RootCountdown < 0 )
    {
        GetRootLocationDelta();
        bRootReset = false;
    }

    RootDelta = GetRootLocationDelta();
    MoveSmooth( RootDelta );

    // HACK: no bForceSkelUpdate so update skeleton manually
    GetBoneCoords('');
}

event AnimEnd( int Channel )
{
    PlaySomeAnim();
}

final function PlaySomeAnim()
{
    local float rand;

    rand = FRand();
    if      ( rand > 0.66 )     ANIM_Next = Anim_Move;
    else if ( rand > 0.33 )     ANIM_Next = Anim_Wander;
    else                        ANIM_Next = Anim_Idle;

    Log( Level.Timeseconds @ ANIM_Next );

    PlayAnim( ANIM_Next, 1, 0.0, 0 );
    RootCountDown = default.RootCountDown;
    bRootReset = true;
}


DefaultProperties
{
    DrawType            = DT_Mesh
    Mesh                = SkeletalMesh'RM_Box.Box'
    Anim                = MeshAnimation'RM_Box.Box'

    bStasis             = False
    RootCountDown       = 1

    Skins(0)            = Material'Engine.MenuGray'

    ANIM_Wander         = "WanderT"
    ANIM_Idle           = "IdleT"
    ANIM_Move           = "MoveT"

    // Not available in Runtime.
//  bForceSkelUpdate    = True
}
 

johnnymak

New Member
Mar 28, 2005
22
0
0
Hi Switch
Thanks this looks great
sorry if this is a dumb question but i compiled the code ok and changed the mesh and anim references to ones i had. But how do i get an instance in game?
Also ,do you think it would be possible to create a new pawn class and use the same idea when it plays anims? Would be great if the actor was placeable in unrealed runtime.
 

johnnymak

New Member
Mar 28, 2005
22
0
0
OK,
I summoned the object ingame and can see the anims changing. great. i just have to make some new anims to test with as the ones i have don't move around enough.
 

Switch`

Pixelante
Feb 27, 2004
98
0
0
Yes, it should be possible. I'd start with overriding all the Pawn functions that handle anims, so only the new Pawn subclass will be controlling anims. There's also some animation code in C++ (in UT2004, not sure about Runtime), set bPhysicsAnimUpdate=false to disable it.

See http://wiki.beyondunreal.com/wiki/UScriptAnimPawn for an example of pure unrealscript animation controller that mimics the UT2004 C++ one. If the application you're working on isn't very similiar to UT2004 I'd start from scratch tho.

To make it placeable change the class declaration to "class RMDummy extends Actor placeable;"
http://udn.epicgames.com/Two/UnrealScriptReference#The_class_declaration
 

johnnymak

New Member
Mar 28, 2005
22
0
0
I tried a new pawn class. works, but not ideally.
With my anims the root point stays at zero but the skeleton and mesh start at zero then move away from zero. So i tried only updating the root point at the start of each new anim.
i did GetBoneCoords('Pelvis') to find the new location of the pawn and then SetLocation() with GetBoneCoords().Origin to reset the root position before the next anim. This works but there is a slight glitch between resetting the root (pawn goes with it with offset) and the new anim beginning with the pawn at zero. Also it seems you used movesmooth() for good reason. do you know a method for getting BoneLocationDelta ? or just have to do the maths?
the collision hull stays at zero position while the anim plays. i'll check out the solution you posted in the thread above.
 

johnnymak

New Member
Mar 28, 2005
22
0
0
hi switch,
did you manage to try this method with animblending? I haven't been able to get it to work with blending. still jumps a bit at start of the new anim. do you think it is possible?
 

Switch`

Pixelante
Feb 27, 2004
98
0
0
johnnymak said:
hi switch,
did you manage to try this method with animblending? I haven't been able to get it to work with blending. still jumps a bit at start of the new anim. do you think it is possible?
bit = to start or couple frames?

I got it to work with some other code I digged up from backup. I was testing this with crappy box anims so it blends but I have no idea about quality or accuracy.

BTW: that SetBoneLocation() call in attached code is most likely a leftover from some older code, I havent noticed any differences after removing it.
 

Attachments

  • RM_Sandbox.zip
    9.6 KB · Views: 42
Last edited:

johnnymak

New Member
Mar 28, 2005
22
0
0
awsome switch!
i'll check it out.
bit = at the start, jumps over on first frame as root resets and then jumps back to new root with new anim.
 

johnnymak

New Member
Mar 28, 2005
22
0
0
we've got a pawn moving around OK using root motion. Thanks switch. Blending between anims is still a little strange, needs tweeking. but the main problem at the moment is that the pawn no longer stays on the terrain as it would in other physics modes, but either floats or goes through the terrain depending on terrain height. Is there a way to maintain terrain collision with root motion physics?
thanks.
 

Switch`

Pixelante
Feb 27, 2004
98
0
0
No problem, glad I could help.

If the pawn doesn't collide with terrain at all then it's most likely because of pawn collision vars. Try those:
Code:
	bCollideWorld				= true
	bCollideActors				= true
	bBlockActors				= true
	bBlockKarma					= false
	bBlockNonZeroExtentTraces	= true
	bBlockZeroExtentTraces		= true
	bUseCylinderCollision		= true
	bProjTarget					= true
	bWorldGeometry				= false
	CollisionRadius				= 14
	CollisionHeight				= 40
SetLocation/Move/MoveSmooth also have some differences, see http://udn.epicgames.com/Two/ActorVariables#Collision and http://udn.epicgames.com/Two/ActorFunctions#SetLocation

Getting root motion to interact with environment well will prolly require special-case code. What works for a root motion walking anim may not for jumping. In case of complex anims Anim Notifies could be handy, to switch the physics algorithms at certain times for example.

Couple ideas:
- get/store/accumulate/whatever relative height above virtual ground in current anim (height above point 0,0,0 in anim browser)
- trace down from pawn to get current height above terrain and ground level
- update pawn location in Z axis to ground level + virtual height (or just ground level), either instantly or over time to simulate falling.
 

johnnymak

New Member
Mar 28, 2005
22
0
0
i did a showdebug on the rootmotion pawn and see that its base is set to none. the normal pawns have terraininfo or something else as their base. I thought maybe using setbase() would assign the terrain for the pawn to walk on but i got compiler erors with setbase(). I may have called it wrong.

also we tried another similar solution not using rootmotion, but doing getbonecoords('Pelvis') and then SetLocation(getbonecoords.origin) right before PlayAnim(next).
This works as well except the player jumps away on last frame before new anim kicks in.
ie. SetLocation moves the root location but moves the offset mesh with it, cause our anims move away from zero and then PlayAnim(next) loads the next anim at the new location causing the mash to jump back to (0,0,0) root location. If there was a way to not render the pawn on the final frame of the old animation so the new anim started with the new location, then that might also work.

Code:
//Reset root position before next animation
simulated function ResetRootLocation()
{
    //USING SETLOCATION
    local coords BonePosition;
    local vector RootDelta2;
    BonePosition = GetBoneCoords('Bip02');
    RootDelta2 = BonePosition.Origin;
    SetLocation(RootDelta2+vect(0,0,-50));
    //END USING SETLOCATION
}
 

johnnymak

New Member
Mar 28, 2005
22
0
0
what would be the best way to get the anims to replicate in lan play?
i tried adding
Code:
SimAnim.AnimSequence = ANIM_Next;
before Playanim() in PlaySomeAnim()
and bReplicateAnimations=true to default properties, but for some reason the anims play back very slowly.
I did also try subclassing pawn and using
Code:
SetAnimAction(ANIM_Next)
the anims played back fine but the rootmotion stopped working.
Any suggestions would be extremely appreciated.