Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (dr_panther, Ayumi, 7th_zorro), 877 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Enemy bend at waist [Re: ] #455631
10/26/15 04:46
10/26/15 04:46

M
Malice
Unregistered
Malice
Unregistered
M



Code:
action monster_code()
{
	
	VECTOR vec_temp;
	ANGLE vec_bend;
	ANGLE ang_bpdiff;
	var limit=0;
	var limit2=0;
	var limit3=0;  

	while(1)
	{
		// get the direction from the entity MY to the entity YOU
	vec_to_angle(vec_bend.pan,vec_diff(NULL,player.x,my.x));
		//    now MY looks at YOU
		ang_diff(ang_bpdiff,vec_bend.pan,my.pan);
		if(abs(ang_bpdiff.pan) >90)
		{
			ent_bonereset(my,"bip01 Spine1");
			vec_to_angle(my.pan,vec_diff(NULL,player.x,my.x));
			ent_bonereset(my,"bip01 Spine1"); // may be overkill
			my.tilt=0;
			my.roll=0;
		} 
		else
		{
			ent_bonereset(my,"bip01 Spine1");
			limit=clamp(ang_bpdiff.tilt,-53,53); //min max
			limit2=clamp(ang_bpdiff.pan,-90,90); //min max
			limit3=clamp(ang_bpdiff.roll,-25,25); //min max
			ent_bonerotate(my, "bip01 Spine1", vector(limit2,limit,limit3));
		}
		wait(1);
	}
}



Code 100% tested and working with Tusker.mdl

I got bored and felt like doing this. Think it's cool. BTW in the bottom left of MED - select the bone - you'll see two name blocks - the bone name bip01 Spine1 and the word"bone". the name is not bone.

No need for a "thank you"- I thought playing with vec_to_ang and Ang_diff would be a fun reminder. Now I played with bones makes me want to build a bone animation system. Lol to much work...

Have fun ,game dev on bill and ted
Mal

Last edited by Malice; 10/26/15 05:11.
Re: Enemy bend at waist [Re: ] #455632
10/26/15 08:04
10/26/15 08:04
Joined: Jun 2010
Posts: 590
California
Ruben Offline OP
User
Ruben  Offline OP
User

Joined: Jun 2010
Posts: 590
California
I ended up trying to edit and sync your original code with my code. I believe it is working. Thank you.

I tried using your new code, but the monster_code is crashing.

Re: Enemy bend at waist [Re: Ruben] #455642
10/26/15 16:31
10/26/15 16:31

M
Malice
Unregistered
Malice
Unregistered
M



Yeah ok, have fun. The code is run 100% crash free in my project so I can't fix that.


Have fun..
Mal

Code:
action monster_code()
{
	
	VECTOR vec_temp;
	ANGLE vec_bend;
	ANGLE ang_bpdiff;
	var limit=0;
	var limit2=0;
	var limit3=0;  

	while(1)
	{
		
		// get the direction from the entity MY to the entity YOU
		set(my,LIGHT);
		vec_to_angle(vec_bend.pan,vec_diff(NULL,player.x,my.x));
		//    now MY looks at YOU
		vec_sub(vec_bend.pan,my.pan);
		if(abs(vec_bend.pan) >90)
		{
			my.red=255;
			ent_bonereset(my,"bip01 Spine1");
			vec_to_angle(my.pan,vec_diff(NULL,player.x,my.x));
			ent_bonereset(my,"bip01 Spine1");
			my.tilt=0;
			my.roll=0;
		} 
		else
		{
			my.red=0;
			ent_bonereset(my,"bip01 Spine1");
			limit=clamp(-vec_bend.tilt,-25,25); //min max
			limit2=clamp(vec_bend.pan,-90,90); //min max
			limit3=clamp(vec_bend.roll,-25,25); //min max
			ent_bonerotate(my, "bip01 Spine1", vector(limit2,limit,0));
		}
		wait(1);
	}
}


Last edited by Malice; 10/26/15 16:53.
Page 2 of 2 1 2

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