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
3 registered members (AndrewAMD, alibaba, VoroneTZ), 916 guests, and 2 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 1 of 2 1 2
bone animation #266979
05/21/09 09:08
05/21/09 09:08
Joined: Mar 2009
Posts: 276
Cebu City, Philippines
boyax Offline OP
Member
boyax  Offline OP
Member

Joined: Mar 2009
Posts: 276
Cebu City, Philippines
Hi,

I got here some problem with bone animation in my model.
I have a model riding in a bicycle. So, turning left/right would also appear his shoulder bones and the bicyle turn left/right.
But I got stucked since it appears the shoulder bones just move/rotate a small angle or seems not moving when turning left/right..

Here's the code:
Code:
action movePlayer()
{
	player = my;  //I'm the player
	var dist_ahead;
	var anim_percent = 0;
	
   //vec_for_min(vFeet,my); // vFeet.z = distance from player origin to lowest vertex		
   	   	
   while (1)
   {		      
		dist_ahead = 5*(key_w-key_s)*time_step;      
      c_move(my,vector(dist_ahead,0,0),nullvector,IGNORE_PASSABLE | GLIDE); // move the player

		// animate the player according to its moved distance				
      if (dist_ahead != 0) // player is moving ahead
      {
         anim_percent += 1.3*dist_ahead; // 1.3 = walk cycle percentage per quant                  
         ent_animate(my,"SlowPedal",anim_percent,ANM_CYCLE); // play the "slow pedal" animation
         
         if(key_a)
         {
         	// rotate the player using the [A] and [D] keys; play animation...
         	my.pan += 1*(key_a-key_d)*time_step;         	
         	ent_animate(my,"TurnLeft",anim_percent,ANM_ADD);
			}
         else if(key_d)
         {
         	my.pan += 1*(key_a-key_d)*time_step;         	
         	ent_animate(my,"TurnRight",anim_percent,ANM_ADD);
			}
      }      

		isometric_camera();
      wait(1);
   }
}


So, turning left/right I use the mode: ANM_ADD

Hope you can advise. Thanks

Re: bone animation [Re: boyax] #267008
05/21/09 12:21
05/21/09 12:21
Joined: Mar 2009
Posts: 276
Cebu City, Philippines
boyax Offline OP
Member
boyax  Offline OP
Member

Joined: Mar 2009
Posts: 276
Cebu City, Philippines
Any idea? or I should have change my code treating it via bone animation coding... confused

Re: bone animation [Re: boyax] #267019
05/21/09 13:54
05/21/09 13:54
Joined: May 2008
Posts: 331
Lithuania, Vilnius
Jaxas Offline
Senior Member
Jaxas  Offline
Senior Member

Joined: May 2008
Posts: 331
Lithuania, Vilnius
try rename animations: turnright to rightturn, turnleft to leftturn (in MED) wink


The smaller the bug, the harder it is to kill.
_________________________________________
Forklift DEMO (3dgs)
Re: bone animation [Re: Jaxas] #267030
05/21/09 14:48
05/21/09 14:48
Joined: Mar 2009
Posts: 276
Cebu City, Philippines
boyax Offline OP
Member
boyax  Offline OP
Member

Joined: Mar 2009
Posts: 276
Cebu City, Philippines
why? is there any difference with the name of frames? still have to try it. Thanks

Re: bone animation [Re: boyax] #267043
05/21/09 15:24
05/21/09 15:24
Joined: May 2008
Posts: 331
Lithuania, Vilnius
Jaxas Offline
Senior Member
Jaxas  Offline
Senior Member

Joined: May 2008
Posts: 331
Lithuania, Vilnius
AFAIK it's necessary to set different names of animation smile once i have similar problem, but change animation names and solve that problem wink


The smaller the bug, the harder it is to kill.
_________________________________________
Forklift DEMO (3dgs)
Re: bone animation [Re: Jaxas] #267069
05/21/09 17:31
05/21/09 17:31
Joined: Mar 2009
Posts: 276
Cebu City, Philippines
boyax Offline OP
Member
boyax  Offline OP
Member

Joined: Mar 2009
Posts: 276
Cebu City, Philippines
I've tried your suggestion but didn't fix it.

Actually, they are of different frame animation.
Here's my animation sequence:
SlowPedal: index 2-48 -> model is on pedal slowly the bike
TurnRight: index 154-177
TurnLeft: index 181-204

So, in MED playing the animation, this how it looks
TurnRight (front):


TurnRight (back):


What I want to do is that, when the model turns right, I'll be playing the SlowPedal+TurnRight animation.
But when I run my code I didn't get the desired output?

It seems it's not playing the TurnRight animation..
Sample output:


I just follow the lite-c workshop on bone animation but it didn't work for me well.

At first, moving forward I play the SlowPedal animation
Code:
ent_animate(my,"SlowPedal",anim_percent,ANM_CYCLE)


Then, when player turns right (key_d is pressed)
Code:
ent_animate(my,"TurnRight",anim_percent,ANM_ADD);


Is there something wrong with the code?

Hope you could advise. Thanks

Re: bone animation [Re: boyax] #267078
05/21/09 19:13
05/21/09 19:13
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
My best guess would be the anim_percent values.
Try separating them into separate counters, say, anim_pedal and anim_turn.

Just in case one has a longer "frame-set" than the other and so one keeps
resetting the other when they share the same percentage variable.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: bone animation [Re: boyax] #267080
05/21/09 19:21
05/21/09 19:21
Joined: May 2008
Posts: 331
Lithuania, Vilnius
Jaxas Offline
Senior Member
Jaxas  Offline
Senior Member

Joined: May 2008
Posts: 331
Lithuania, Vilnius
i just read in manual that ANM_ADD need to use with ANM_CYCLE:
ent_animate(my,"TurnRight",anim_percent,ANM_CYCLE+ANM_ADD);
try that wink


The smaller the bug, the harder it is to kill.
_________________________________________
Forklift DEMO (3dgs)
Re: bone animation [Re: Jaxas] #267145
05/22/09 08:18
05/22/09 08:18
Joined: Mar 2009
Posts: 276
Cebu City, Philippines
boyax Offline OP
Member
boyax  Offline OP
Member

Joined: Mar 2009
Posts: 276
Cebu City, Philippines
Hi,

I try the suggestions but didn't work well for me... frown

Anyway, other solution I have is to rotate the spine bone when turning left/right.

I'm able to locate the Spine bone.


some questions:
1. When selecting the bone mode, rotate, hope someone could clarify me which is the x,y and z vertex? or is it pan,tilt,roll angles?
2. In MED, clicking bone mode, there's a toolbar below that shows the position of the vertex (bone):
x,y,z, ?, name of the bone, mode, current selection
What's the 4th refers to?

I should be adjusting the blue arrow/vertex... but i'm not sure how I should do it adjusting the angle..?
I just have to use
ent_bonerotate( ENTITY*,STRING* name,VECTOR* angle)

Any advise? Thanks

Re: bone animation [Re: boyax] #267162
05/22/09 09:44
05/22/09 09:44
Joined: Mar 2009
Posts: 276
Cebu City, Philippines
boyax Offline OP
Member
boyax  Offline OP
Member

Joined: Mar 2009
Posts: 276
Cebu City, Philippines
I already solved this one. Thanks. smile

Page 1 of 2 1 2

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