Inside3D!
     

Teleport to plat. Critique, and what could be done better?

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
gnounc



Joined: 06 Apr 2009
Posts: 120

PostPosted: Wed Oct 14, 2009 9:22 am    Post subject: Teleport to plat. Critique, and what could be done better? Reply with quote

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
View user's profile Send private message
gnounc



Joined: 06 Apr 2009
Posts: 120

PostPosted: Wed Oct 14, 2009 9:33 am    Post subject: Teleport to platform Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Page 1 of 1

 
Jump to:  
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