Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

MojoActions.TsActionKeyframeInterpolate


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
class TsActionKeyframeInterpolate extends TsActionInterpolateBase
	native;

var(Action) float duration;
var(Action) float ease_in_time;
var(Action) float ease_out_time;
var(Action) bool snap_to_first_key;
var(Action) bool use_linear_rotation;

var(keys) array<MojoKeyframe> keys;

var(LookAt) enum LookAtType
{
	LOOKAT_UseKeyframe,
	LOOKAT_Actor,
	LOOKAT_Point,
} look_at_type;
var(LookAt) MojoKeyframe look_at_point;
var(LookAt) MojoActorRef look_at_actor;
var(LookAt) float look_at_ease_time;

var float cur_time;

///////////////////////////////////////////////////////////////////////////////
// constants used by native interpolation
///////////////////////////////////////////////////////////////////////////////

var const int	cur_key;
var const float src_key_distance;
var const float dest_key_distance;
var const transient noexport int spline; // native spline class


native function CalculateConstants(vector initial_pos, rotator initial_rot);
native function bool UpdateCurrentKeyframePos(float time);

function bool OnStart()
{
	if (keys.Length == 0 || duration <= 0)
		return false;

	cur_time = 0;

	if (look_at_type == LOOKAT_Actor)
	{
		look_at_actor = ResolveActorRef(look_at_actor);
		if (look_at_actor.actor == None)
			Log("TsActionKeyframeInterpolate: Warning, unable to resolve look_at_actor, "$look_at_actor.name);
	}

	CalculateConstants(Actor.Location, Actor.Rotation);
	StartActorInterpolation();

	return true;
}

function bool OnTick(float delta)
{
	local bool still_active;

	cur_time += delta;
	still_active = UpdateCurrentKeyframePos(cur_time);
	ApplyCurrentKeyframePos();

	return still_active;
}

function OnFinish()
{
	FinishActorInterpolation();
}

event bool SetDuration(float _duration)
{
	duration = _duration;
	return true;
}

event float GetDuration()
{
	return Duration;
}

defaultproperties
{
	DName				="Path Interpolate"
	Track				="Position"
	Help				="Interpolate an object at constant velocity along a path"
	UsesDuration		=true

	duration		= 4.0f;
	ease_in_time	= 0.0f;
	ease_out_time	= 0.0f;
	snap_to_first_key = false;
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: ne 5.9.2004 15:53:36.000 - Creation time: st 23.5.2018 00:10:49.307 - Created with UnCodeX