How to rotate a model without destroying the animations ?

Posted By: Anewbie

How to rotate a model without destroying the animations ? - 10/30/18 15:28

So I was developing a simple AI that starts chasing the player after it seeing it but there is something wrong about the animation. The model basically runs like a crab which means sideways. I tried with other models and there is no problem however this particular one is not facing the direction it is supposed to be facing in MED. There is like a 45 degree difference. I tried just simply selecting all then rotating it but that results in the running animation being an abomination. Skeleton completely gets destroyed. Anyway to get around this ? Either through MED or script ?

This is how I turn the model by the way :

vec_diff(temp_vec,player.x,my.x);
vec_to_angle(temp_angle,temp_vec);
my.pan += ang(temp_angle.pan - my.pan) * 0.45 * time_step;
Posted By: Superku

Re: How to rotate a model without destroying the animations ? - 10/30/18 16:53

Just add or subtract 45°:
my.pan += ang(temp_angle.pan + 45 - my.pan) * 0.45 * time_step;

If you move your enemy via the first (local) c_move argument you will need to rotate the speed vector by 45°, or adapt the global c_move direction vector accordingly.
Posted By: Anewbie

Re: How to rotate a model without destroying the animations ? - 10/30/18 17:10

Originally Posted By: Superku
Just add or subtract 45°:
my.pan += ang(temp_angle.pan + 45 - my.pan) * 0.45 * time_step;



Yes, this works but this also means that i can only use this script for a single model. I was kinda trying to avoid this. But i guess there is no better solution that will prevent me from changing the model. Thanks !
Posted By: Superku

Re: How to rotate a model without destroying the animations ? - 10/30/18 18:05

Make it skill based and only set the skill to non-zero/ 45 for that specific model.

Code:
//skill1: angleCorrection 0
action enemy()
{
	...
	my.pan += ang(temp_angle.pan + my.skill1 - my.pan) * 0.45 * time_step;
}

alternative:

//flag3: crab_mdl 0
action enemy()
{
	if(is(my,FLAG3))
	{
		my.skill1 = 45;
		other specific settings for this model
	}
	...
	my.pan += ang(temp_angle.pan + my.skill1 - my.pan) * 0.45 * time_step;
}

© 2024 lite-C Forums