View previous topic :: View next topic |
Author |
Message |
gnounc

Joined: 06 Apr 2009 Posts: 120
|
Posted: Wed Oct 14, 2009 9:22 am Post subject: Teleport to plat. Critique, and what could be done better? |
|
|
Thanks to Daemon and Rich for help with vectors.
And krimzon for a few corrections.
I wrote out a teleport to distant platform function.
I'd like to know what could be done better, what is poor
technique, and lastly, why it only works when you hit
something square on.
Details below.
Last edited by gnounc on Wed Oct 14, 2009 10:14 am; edited 2 times in total |
|
Back to top |
|
 |
gnounc

Joined: 06 Apr 2009 Posts: 120
|
Posted: Wed Oct 14, 2009 9:33 am Post subject: Teleport to platform |
|
|
Diagram
http://farm4.static.flickr.com/3477/4011150296_0ee3ac8023_o.jpg
Code: | /*
================
W_Superjump
================
*/void () W_Superjump
{
local vector org, o, x;
org = self.origin + '0 0 16';
//aim above the ledge you would like to teleport to
//get wall position
makevectors (self.v_angle);
traceline (org, org + v_forward*600, FALSE, self);
o = trace_endpos - v_forward;
//get adjoining floor position
traceline(o,o + '0 0 -600', FALSE, self);
o = trace_endpos;
//draw line from wall/floor joint perpindicular to players vertical axis
//drop line 2 units to find front face of ledge
org_z = o_z;
traceline(org - '0 0 2', o - '0 0 2', FALSE, self);
//get length of line between front face of ledge, and where the wall meets the floor, cut that in half to
//get half the depth of the platform
//bump traceline up 2 units so you dont spawn inside the floor
traceline(trace_endpos, o - '0 0 2', FALSE, self);
x = trace_endpos + ((o - (trace_endpos + '0 0 2')) * 0.5);
//place the player in the relative middle of platform
setorigin(self,x);
}; |
|
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2004 phpBB Group
|