Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New extension: Bounce Raycasts #1238

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

github-actions[bot]
Copy link
Contributor

Description

This extension adds the functionality to simulate bouncing raycasts with a maximum amount of bounces set by the user.

How to use the extension

This extension adds 3 actions:
Bounce raycasts - simulates bouncing raycasts with a maximum amount of bounces.
Bounce and draw raycasts - simulates bouncing raycasts and immediately draws the bounces using a shape painter object.
Draw raycast bounces from a variable - allows the user to draw the bounces from a previously saved simulation using a shape painter object.

The raycast results are stored in a structure variable.
Example variable

Checklist

  • I've followed all of the best practices.
  • I confirm that this extension can be integrated to this GitHub repository, distributed and MIT licensed.
  • I am aware that the extension may be updated by anyone, and do not need my explicit consent to do so.

What tier of review do you aim for your extension?

Community (Unreviewed)

Example file

BounceRaycastsExample.zip

Extension file

BounceRaycasts.zip

@github-actions github-actions bot requested a review from a team as a code owner March 31, 2024 14:32
@github-actions github-actions bot added the ✨ New extension A new extension label Mar 31, 2024
@github-actions github-actions bot added this to Needs review in Extensions review Mar 31, 2024
@github-actions github-actions bot mentioned this pull request Mar 31, 2024
3 tasks
@NiQsterVX
Copy link

I realised how to add one feature. If anyone is currently testing this, give me a moment.

@NiQsterVX
Copy link

!update
BounceRaycastsExample.zip

Copy link
Contributor Author

❗ No updates found. Please check your file.

@NiQsterVX
Copy link

NiQsterVX commented Mar 31, 2024

Stupid bot,
Updated example:
BounceRaycastsExample.zip

Updated extension:
BounceRaycasts.zip

Sometimes the ray might not hit the object. I updated the extension so that it checks for that. If the ray doesn't hit anything, the extension will calculate the end position of the ray.

@D8H
Copy link
Contributor

D8H commented Apr 6, 2024

Thank you for submitting an extension.

Are you using this extension for your project? If you have a public build or some gameplay footage, feel free to add links. It will help reviewers.
Please do a list of all the use cases that comes in mind, for instance something like "Show a trajectory when players aim".

@NiQsterVX
Copy link

Preview.of.Pug.Pong.2024-04-07.11-56-38.mp4
Preview.of.Bounce.raycasts.extension.2024-04-07.12-24-12.mp4
Preview.of.Bounce.raycasts.extension.2024-04-07.12-36-09.mp4

I also updated the extension to include 2 more things: Obstacle angle (used for the platformer example) and a toggle to check for the total distance travelled by the ray instead of a per bounce basis. Useful when there should be limited distance because normally each ray is separated.

The second ray example:

Preview.of.Bounce.raycasts.extension.2024-04-07.13-09-21.mp4

I also really wanted this extension to check grenade throws in one of my games. My solution back then was to just simulate all of the possible grenade throws. This will allow for a much easier and faster way to do this.
https://twitter.com/AppthonyGames/status/1736026269689532895

@NiQsterVX
Copy link

Updated example and extension:

BounceRaycastsExtension.zip

BounceRaycastsExample.zip

@D8H
Copy link
Contributor

D8H commented Apr 7, 2024

Thank you for the explanations.

If I understand correctly, the main purpose of this extension is to:

  • predict a tiny projectile trajectory with bonces.

It allows to:

  • show an aiming aid
  • help to make AI

Limitations:

  • It can only be used with tiny projectiles
  • It can't be used with the Bounce extension because the trajectory won't match

Do you see something to add or to correct?

@NiQsterVX
Copy link

NiQsterVX commented Apr 7, 2024

I tested the bounce extension, the trajectories do seem to match somewhat well. It's more to do with the fact that a raycast doesn't use a collision mask, so the trajectories will change because of that. It does seem to adjust and go a little offsync repeatedly. Sometimes it's pretty much spot on, sometimes (most likely due to tilted walls) it seems to skew a little but it also seems to slightly return to the ray trajectory over time. Generally it does a pretty neat job at predicting bounces (I tested this on a square with a resolution of 10x10).

@NiQsterVX
Copy link

NiQsterVX commented Apr 7, 2024

What a person can do to guarantee accuracy is this:
obraz
Index starts at -1 (because for some reason it increments it by 1 automatically), it will properly follow the trajectory up until the bounces end, then it goes to 0;0 but that's easily fixable.

@NiQsterVX
Copy link

I updated the extension to support shapecasting too.
AdvancedRaycastAndShapecast Example.zip
AdvancedRaycastAndShapecast.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ New extension A new extension
Projects
Extensions review
  
Needs review
Development

Successfully merging this pull request may close these issues.

None yet

2 participants