Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, dr_panther, 2 invisible), 1,056 guests, and 0 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
ent_blendframe #407576
09/16/12 03:06
09/16/12 03:06
Joined: Sep 2009
Posts: 84
Theil Offline OP
Junior Member
Theil  Offline OP
Junior Member

Joined: Sep 2009
Posts: 84
Hi I have a problem with this function I can't wrap my head around it I don't seem to understand how to use it frown can somebody please help me understand this function?
Here is a simple script for walking
Code:
if(key_w == ON || key_d == ON || key_s == ON || key_a == ON){
		if(key_w == ON && key_s == ON || key_a == ON && key_d == ON){
			ent_animate(me,"stand",my.skill1,ANM_CYCLE);
				my.skill1+=5*time_step;
				my.skill1 %= 100;
				my.skill2 = 0;
		}else{
		
			ent_animate(me,"walk",my.skill2,ANM_CYCLE);
			if(my.skill2 <= 100){
				ent_blendframe(me,NULL,"walk",6,my.skill2);
			}
			my.skill2+=1*time_step;
		}
	} else{
		ent_animate(me,"stand",my.skill1,ANM_CYCLE);
		my.skill1+=5*time_step;
		my.skill1 %= 100;	my.skill2 = 0;
	}



it runs within a while loop but I can't get ent_blendframe to work properly. any suggestion? thanks a lot for reading.

Last edited by Theil; 09/16/12 15:42.
Re: ent_blendframe [Re: Theil] #407756
09/19/12 01:39
09/19/12 01:39
Joined: Sep 2009
Posts: 84
Theil Offline OP
Junior Member
Theil  Offline OP
Junior Member

Joined: Sep 2009
Posts: 84
any answer? =/ I cannot get any good result and I can't find anything else besides the documentation and I also found a few threads about it but are still confusing to me and even to the op, I don't know what to do.

Re: ent_blendframe [Re: Theil] #407757
09/19/12 01:53
09/19/12 01: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)
What is the problem with the function, what does "I can't get ent_blendframe to work properly" mean?


"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: ent_blendframe [Re: Superku] #407759
09/19/12 02:15
09/19/12 02:15
Joined: Sep 2009
Posts: 84
Theil Offline OP
Junior Member
Theil  Offline OP
Junior Member

Joined: Sep 2009
Posts: 84
I've been experimenting with it trying to blend one animation to the next one but I get this kind of snapping, as if it's skipping animation frames.

as my exmaple above I have
ent_blendframe(me,NULL,"walk",6,my.skill2);
so help me understand what should go in the fourth parameter? I tried 0 and even the my.skill1 and 2 with no smooth blending results.

according to the documentation the fourth parameter is:
anim_percent Percentage within the target scene, 0..100
but what does this exactly means? thanks for answering superku wink

Re: ent_blendframe [Re: Theil] #407760
09/19/12 02:31
09/19/12 02:31
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Blending doesn't work too well with vertex animations, you can only blend between two full (integer) frames.
Imagine the following scenario:
"walk" consists of 10 frames, my.skill2 is 37. After the instruction
ent_animate(me,"walk",my.skill2,0);
your model's mesh will be blended by 70% from walk frame 3 to frame 4.

When you now call
ent_blendframe(me,NULL,"stand",6,75);
you try to blend the walk frame 3.7 and the stand frame 0.6 but as you can only blend between integers resp. the "entity.frame" and "entity.next_frame" parameters, the result will be a blend of walk frame 4 (or 3, I don't know if the function searches the closest or the next-lower integer) and stand frame 1 (or 0). Thus there will be some kind of snapping.

It's very hard to explain, especially in English, just keep in mind that ent_animate and ent_blendframe (probably) only set the frame and next_frame parameters, the resulting mesh is calculated afterwards before rendering.


EDIT: What you can try is to let an animation reach a full integer frame and then blend to another integer frame of the stand cycle.

Last edited by Superku; 09/19/12 02:33.

"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

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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