Okay, so the setup provided here works for simple adventure titles, I guess, but it's inadequate for plenty of projects, and the collision is buggy and it's really not a replacement for a c_move (just a workaround).

So I did a little searching around this forum and found an algorithm for calculating GLIDE from a simple trace. If anyone still wants a complete "horror template," I can still do that - but until then, enjoy this quick single-trace move.

NOTE: It still needs work! Touching two solid surfaces at once allows you to phase through walls in this script - I still need to add another trace or two to make it perfect.

Code:
var move_vel;
var move_dot;
var move_vec[3];
var move_vec2[3];

function player_move(&velocity)
{
	vec_set(move_vec, velocity);
	move_vel = vec_length(velocity);
	if(move_vel == 0)
	{
		vec_set(my_speed, nullvector);
		return;
	}
	vec_set(temp, my.x);
	vec_add(temp, move_vec);
	
	result = c_trace(my.x, temp, ignore_passable+ignore_passents+ignore_me+use_box+ignore_push);
	if(!trace_hit)
	{
		vec_set(my_speed, temp);
		vec_sub(my_speed, my.x);
		vec_set(my.x, temp);
	}
	else
	{
		move_dot = vec_dot(move_vec, normal)/move_vel;
		vec_set(temp, normal);
		vec_scale(temp, abs(move_dot)*move_vel);
		vec_set(move_vec2, move_vec);
		vec_add(move_vec2, temp);
		
		vec_add(my.x, move_vec2);
		vec_set(my_speed, move_vec2);
	}
}



I swapped out c_move for this function in my other hobby project (rewrite of my Halo clone) and it worked almost flawlessly.

Last edited by MatAllum; 03/06/12 19:47.