Gamestudio Links
Zorro Links
Newest Posts
StartWeek not working as it should
by jcl. 04/20/24 08:38
Data from CSV not parsed correctly
by jcl. 04/20/24 08:32
Zorro FIX plugin - Experimental
by jcl. 04/20/24 08:30
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (7th_zorro, Aku_Aku, henrybane, flink, 1 invisible), 739 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 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