Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, The_Judge, Grant), 898 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How to rotate a model without destroying the animations ? #474693
10/30/18 15:28
10/30/18 15:28
Joined: Oct 2018
Posts: 10
A
Anewbie Offline OP
Newbie
Anewbie  Offline OP
Newbie
A

Joined: Oct 2018
Posts: 10
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;

Re: How to rotate a model without destroying the animations ? [Re: Anewbie] #474695
10/30/18 16:53
10/30/18 16:53
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
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.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: How to rotate a model without destroying the animations ? [Re: Superku] #474696
10/30/18 17:10
10/30/18 17:10
Joined: Oct 2018
Posts: 10
A
Anewbie Offline OP
Newbie
Anewbie  Offline OP
Newbie
A

Joined: Oct 2018
Posts: 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 !

Re: How to rotate a model without destroying the animations ? [Re: Anewbie] #474697
10/30/18 18:05
10/30/18 18:05
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
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;
}



"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1