I was going to put up my old wall hangng code but it really is as simple as I described above. Here it is anyway heavily edited down but what you need is here

Code:
vec_set(wall_finder.x,vector(200,0,26));//26 being the position of my hands in wall hanging animation
vec_rotate(wall_finder.x,my.pan);
vec_add(wall_finder.x,my.x);  
vec_set(from_player.x,vector(0,0,26)); 
vec_rotate(from_player.x,my.pan);	
vec_add(from_player.x,my.x); 
wall_distance = c_trace(from_player.x,wall_finder.x,use_box | ignore_me | ignore_passable);

IF(wall_distance == 0)//define this further so it does not work when on ground and only up against a wall,eg, when jumping and wall_distance previously was != 0
{
gravity_on = 0;//condition for gravity to work when at 1
current_speed = 0;//my forward motion stopped
//now play wall hanging animation here
}



The only difficult part is rotating the player to the wall

Here is the code for doing that
Code:
vec_set(wall_angle_finder.x,vector(200,0,0));//create a vector to trace 200 quants to in front of player 
vec_rotate(wall_angle_finder.x,my.pan);//rotate it to the rotation of the player
vec_add(wall_angle_finder.x,vector(my.x,my.y,my.z));//add it to the position of the player
find_wall_angle = c_trace(my.x,wall_angle_finder.x,use_box | ignore_me | ignore_passable);//trace 200 quants in front of player 	
vec_set(wallNormal, normal);//set wallNormal to the returned normal vector of the wall	 				 				 		
vec_to_angle(wallNormal, wallNormal);//convert the vector to its angle			
wallNormal.pan += 180;//swing it around to point away from player, normals point out of a wall, we want it pointing in			
wall_degrees = ang(wallNormal.pan - my.pan);	//find the angle difference between the normal and the player	


Now use wall_degrees to rotate your character to face the wall

Last edited by TigerTao; 07/17/08 19:52.