Jump to content

PlayThread


Hodo33
 Share

Recommended Posts

I have a door with a wheel that turns when you open it. When you close the door it should turn the wheel the other way.


%door.setThreadDir(0,true);

%door.playthread(0,"Wheel");

%door.stopThread(0);


%door.setThreadDir(0,false);

%door.playthread(0,"Wheel");

%door.stopThread(0);


This does not work.... seems stopThread resets the seq to frame 0

I changed the anim to not be cyclic and still does not work.

What am I doing wrong here?

Link to comment
Share on other sites

function smartPlayThread(%obj,%anim,%direction)
{
	if (!isObject(%obj)) return;
	%obj.inTransition = true;
	if (%direction)
	{
		%obj.stopThread(0);
		%obj.playThread( 0,%anim );
		%obj.setThreadDir(0,true);
	}
	else
	{
		//play anim backwards
		%obj.stopThread(0);
		%obj.playThread( 0, %anim );
		%obj.setThreadPosition(0,1);
		%obj.setThreadDir(0,false);
	}
	//while were at it, trip any synced animations for stuff mounted to us
	%count = %obj.getMountedObjectCount();
	for (%i=0; %i<%count; %i++)
	{
		smartPlayThread(%obj.getMountedObject(%i),%anim,%direction);
	}
}

I use this a lot, personally.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...