MCPcopy Create free account
hub / github.com/demoth/jake2 / PM_StepSlideMove_

Method PM_StepSlideMove_

qcommon/src/main/java/jake2/qcommon/PMove.java:121–218  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

119 static float[] planes[] = new float[MAX_CLIP_PLANES][3];
120
121 public static void PM_StepSlideMove_() {
122 int bumpcount, numbumps;
123 float[] dir = { 0, 0, 0 };
124 float d;
125 int numplanes;
126
127 float[] primal_velocity = { 0, 0, 0 };
128 int i, j;
129 trace_t trace;
130 float[] end = { 0, 0, 0 };
131 float time_left;
132
133 numbumps = 4;
134
135 Math3D.VectorCopy(pml.velocity, primal_velocity);
136 numplanes = 0;
137
138 time_left = pml.frametime;
139
140 for (bumpcount = 0; bumpcount < numbumps; bumpcount++) {
141 for (i = 0; i < 3; i++)
142 end[i] = pml.origin[i] + time_left
143 * pml.velocity[i];
144
145 trace = pm.trace.trace(pml.origin, pm.mins,
146 pm.maxs, end);
147
148 if (trace.allsolid) { // entity is trapped in another solid
149 pml.velocity[2] = 0; // don't build up falling damage
150 return;
151 }
152
153 if (trace.fraction > 0) { // actually covered some distance
154 Math3D.VectorCopy(trace.endpos, pml.origin);
155 numplanes = 0;
156 }
157
158 if (trace.fraction == 1)
159 break; // moved the entire distance
160
161 // save entity for contact
162 if (pm.numtouch < Defines.MAXTOUCH && trace.ent != null) {
163 pm.touchents[pm.numtouch] = trace.ent;
164 pm.numtouch++;
165 }
166
167 time_left -= time_left * trace.fraction;
168
169 // slide along this plane
170 if (numplanes >= MAX_CLIP_PLANES) {
171 // this shouldn't really happen
172 Math3D.VectorCopy(Globals.vec3_origin, pml.velocity);
173 break;
174 }
175
176 Math3D.VectorCopy(trace.plane.normal, planes[numplanes]);
177 numplanes++;
178

Callers 1

PM_StepSlideMoveMethod · 0.95

Calls 6

VectorCopyMethod · 0.95
PM_ClipVelocityMethod · 0.95
DotProductMethod · 0.95
CrossProductMethod · 0.95
VectorScaleMethod · 0.95
traceMethod · 0.65

Tested by

no test coverage detected