• Breaking News

    Calculating laser trajectory under influence of gravity In this game certain entities emit lasers (called beams). These beams advance forward a little bit, and then are checked for collisions (I used to use raycasting, but the need for black holes kind of ruined that approach). Beams are basically a list of points where it advanced. This list is later used to create the mesh for the visuals. Once a collision is found something happens to the lasers position and direction, but with black holes I have no clue how to go about this. So far, the function looks like this: while(!beamsToSimulate.empty()) for(beam in beamsToSimulate) nextPoint = beam.points[beam.points.size() - 1].position + beam.points[beam.points.size() - 1].direction * 0.25; // Small distance to advance. // check if it has collided, or is already inside, or has exited anything How should I change the direction of a beam under the influence of gravity? I thought about lerping the current direction with the normalized difference vector between it and the black hole, but what interpolant to use I don't know either. https://ift.tt/eA8V8J

    In this game certain entities emit lasers (called beams). These beams advance forward a little bit, and then are checked for collisions (I used to use raycasting, but the need for black holes kind of ruined that approach). Beams are basically a list of points where it advanced. This list is later used to create the mesh for the visuals. Once a collision is found something happens to the lasers position and direction, but with black holes I have no clue how to go about this. So far, the function looks like this: while(!beamsToSimulate.empty()) for(beam in beamsToSimulate) nextPoint = beam.points[beam.points.size() - 1].position + beam.points[beam.points.size() - 1].direction * 0.25; // Small distance to advance. // check if it has collided, or is already inside, or has exited anything How should I change the direction of a beam under the influence of gravity? I thought about lerping the current direction with the normalized difference vector between it and the black hole, but what interpolant to use I don't know either.

    from GameDev.net https://ift.tt/2MWg7yn

    ليست هناك تعليقات

    Post Top Ad

    ad728

    Post Bottom Ad

    ad728