I've been working on a "wall running" script, but I'm quite a novice so I don't know if I'm on the right track. Basically what I want this to do is that if a character is standing on a surface that is not level, to turn its body so that it is standing 'upright', directly from the normal.

I came up with this script from a "place_me_on_floor" script, changed so it would be applicable to any surface.

Code:
function place_me_on_surface
{	
	vec_set(temp,my.z); //set primary vector
 	temp.z -= 5; // 'bout half a foot from the surface
	var_angle[3] + { my.pan, my.tilt, my.roll }; // point angle in the direction of character's feet
	vec_rotate(temp,angle); //rotate vector
 	c_trace(my.z, temp, IGNORE_ME); //trace from character's feet about half a foot
 	vec_set(my.z, target); // put on surface
 	vec_to_angle(my.tilt, normal); // stand "upright" from normal
 	vec_to_angle(my.roll, normal);
}	 


Last edited by Tuah; 01/22/09 16:39.