public void Execute(Int32 index) { Single t = (Single)index * this.indexMult; this.outputPositions[index] = Trajectory.CalculatePositionAtTime(this.origin, this.velocity, t, this.gravity); }
// Token: 0x0600296B RID: 10603 RVA: 0x000AE5A8 File Offset: 0x000AC7A8 public void Execute(int index) { float t = (float)index * this.indexMultiplier; this.outputPositions[index] = Trajectory.CalculatePositionAtTime(this.origin, this.velocity, t, this.gravity); }
private void UpdateTrajInfo(out TrajectoryInfo traj) { traj = default(TrajectoryInfo); Ray aimRay = base.GetAimRay(); RaycastHit rHit = default(RaycastHit); Vector3 direction = aimRay.direction; direction.y = Mathf.Max(direction.y, EntityStates.Croco.BaseLeap.minimumY); Vector3 a = direction.normalized * EntityStates.Croco.BaseLeap.aimVelocity * this.moveSpeedStat; Vector3 b = Vector3.up * EntityStates.Croco.BaseLeap.upwardVelocity; Vector3 b2 = new Vector3(direction.x, 0f, direction.z).normalized *EntityStates.Croco.BaseLeap.forwardVelocity; Vector3 velocity = a + b + b2; Vector3 tempVelocity = velocity; Ray r = new Ray(aimRay.origin, velocity); Single time = Trajectory.CalculateFlightDuration(velocity.y); Single timeStep = time / 25f; Vector3 oldPos = aimRay.origin; Boolean hit = false; List <Vector3> vecs = new List <Vector3>(100); for (Int32 i = 0; i < 100; i++) { Vector3 pos = Trajectory.CalculatePositionAtTime(r.origin, tempVelocity, timeStep * i, Physics.gravity.y); tempVelocity *= Mathf.Exp(timeStep * -0.4f); hit = Physics.SphereCast(oldPos, 0.2f, (pos - oldPos), out rHit, (pos - oldPos).magnitude, LayerIndex.world.mask | LayerIndex.entityPrecise.mask, QueryTriggerInteraction.UseGlobal); if (hit) { break; } oldPos = pos; vecs.Add(pos); } arcLineRender.positionCount = vecs.Count; arcLineRender.SetPositions(vecs.ToArray()); if (hit) { traj.hitPoint = rHit.point; traj.hitNormal = rHit.normal; } else { traj.hitPoint = oldPos; traj.hitNormal = Vector3.up; } Vector3 diff = traj.hitPoint - aimRay.origin; if (useGravity) { Single speed = velocity.magnitude; Vector2 flatDiff = new Vector2(diff.x, diff.z); Single flatDist = flatDiff.magnitude; Single yStart = Trajectory.CalculateInitialYSpeed(flatDist / speed, diff.y); Vector3 speedVec = new Vector3(flatDiff.x / flatDist * speed, yStart, flatDiff.y / flatDist * speed); traj.speedOverride = speedVec.magnitude; traj.finalRay = new Ray(aimRay.origin, speedVec / traj.speedOverride); traj.travelTime = Trajectory.CalculateGroundTravelTime(speed, flatDist); return; } traj.speedOverride = baseSpeed; traj.finalRay = aimRay; traj.travelTime = baseSpeed / diff.magnitude; }