Hello,

I am writing a walking mech game. This involves using a model with bones. If I try to alter the pan in-game the mesh distorts. Does this mean I have to use ent_bonerotate on the parent of the bones to rotate the model or is something terribly wrong?

-Ed

http://indiegamingportal.net/uploads/screenshots/2008-04-16_032401.jpg

Here is my code:

 Code:
#include <acknex.h>
#include <default.c>
VECTOR vSpeed, vAngularSpeed, vForce, vMove, vKick, velocity, vec;
var walk_speed, cabin_rotate, gun_rotate;

action mech()
{
	set(my,SHADOW);
	my.material = mat_metal;
	
			camera.y = my.y - 50*sin(my.pan);
		camera.x = my.x - 50*cos(my.pan);
		camera.z = my.z + 230;
		camera.tilt = -10;
		camera.pan = my.pan-180;
		
	
	while(1)
	{
		ent_animate(my, NULL, 0, 0); // reset all the animations

		walk_speed += 4 * time_step; // increase walk_speed; 1.5 sets the speed
		gun_rotate -= mouse_force.y;
		cabin_rotate -= mouse_force.x;
		if (key_w){
			ent_animate(my, "walk", walk_speed, ANM_CYCLE);
			c_move(me,vector(-3*time_step,0,0),nullvector,IGNORE_YOU|GLIDE);
			my.pan += 2;
		}
		
		ent_bonerotate(my,"railgun",vector(0,gun_rotate,0 ));
		ent_bonerotate(my,"cabin",vector(cabin_rotate,0, 0));
		
		if(!c_trace (my.x,vector(0,0,-1),IGNORE_ME|IGNORE_PASSABLE)){
			c_move(me,vector(0,0,-30*time_step),nullvector,IGNORE_YOU|GLIDE);
		} 
		

		wait(1);
	}
}

function main()
{
	level_load("terrain_desert.hmp");
	//shadow_stencil = 1;
	wait(3);
	ph_setgravity(vector(0,0,-386));
	ent_create("mech_walk.mdl",vector(0,0,200),mech);
	
}


Last edited by crumply; 04/16/08 02:25.