Teleport to plat. Critique, and what could be done better?
Moderator: InsideQC Admins
2 posts
• Page 1 of 1
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.
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.
-

gnounc - Posts: 424
- Joined: Mon Apr 06, 2009 6:26 am
Teleport to platform
Diagram
http://farm4.static.flickr.com/3477/4011150296_0ee3ac8023_o.jpg
http://farm4.static.flickr.com/3477/4011150296_0ee3ac8023_o.jpg
- Code: Select all
/*
================
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);
};
-

gnounc - Posts: 424
- Joined: Mon Apr 06, 2009 6:26 am
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest