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

Tools for 3D #1051

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

Tools for 3D #1051

wants to merge 1 commit into from

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Oct 13, 2023

Description

A collection of small tools for 3D that are missing in the core functionality.

Tools For 3D includes.

  • Return the Distance between 3D positions.
  • Return the Tilt / Vertical Angle between 3D positions.
  • Places a 3D Object around a specified point, angles and distance.
    Orientation of the 3D object can also be set.
  • Check if the 3D position is inside the 3D Object.
    This check is rudimentary for mostly upright objects.
    The check works properly on Objects rotated only on Z-axis.
    To get the the check against MODEL correct, the Origin needs to be set on bottom middle.
  • Check collision between 3D Objects.
    Perfect for checking collision with 3dBoxes used for floors, walls, bridges, and upright obstacles like characters, furniture, pillars, etc.
    This check is rudimentary for mostly upright objects.
    This check works properly on Objects rotated only on Z-axis.
    To get the the MODEL collision correct, the Origin needs to be set on bottom middle.
    Or you use a hidden 3D Box as a collision mask for the model, just like done sometimes with 2d sprites.

Combines and replaces Extension suggestions #1039 #1046 #1048

How to use the extension

Put object around a 3D Position.

  • Use the event to place the 3D Object around a 3D Position space with desired angle, distance and orientation.

Test if the Position in 3d to is inside a 3D Object.

  • Returns True if the point is inside the given object boundaries.
  • Some limitations are that object needs to be upright so that rotation in X/Y axis aren't made.

Distance Between 3D Positions.

  • Returns a value of a distance between 3D Positions.

Tilt Between 3D Positions.

  • Returns a Tilt/ Vertical Angle value in degrees between 3d Positions.

Check collision between 3D Objects.

  • Returns True if the 3D Objects are colliding with eachother.
    Use for checking collision with 3dBoxes used for floors, walls, bridges, and upright obstacles like characters, furniture, pillars, etc.
    This check is rudimentary for mostly upright objects.
    This check works properly on Objects rotated only on Z-axis.
    To get the the MODEL collision correct, the Origin needs to be set on bottom middle.
    Or use a hidden 3D Box as a collision mask for the model, just like done sometimes with 2d sprites.

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?

Reviewed

Example file

ToolsFor3DExample.zip

Extension file

ToolsFor3D.zip

EDIT:
The example now includes all extension usage as well as grabbing, moving and dropping objects.

Link to example to run in gd.games.
https://gd.games/instant-builds/3341ba35-f62d-46c6-946e-fb883ab1d92c

@github-actions github-actions bot requested a review from a team as a code owner October 13, 2023 11:35
@github-actions github-actions bot added the ✨ New extension A new extension label Oct 13, 2023
@github-actions github-actions bot mentioned this pull request Oct 13, 2023
3 tasks
@VanCastar
Copy link

A few loose ends that I missed will be fixed today, the example is missing some features that I forgot to add.

@D8H
Copy link
Contributor

D8H commented Nov 22, 2023

Thank you for submitting an extension.

I have some suggestions:

  • TiltBetween3DPositions won't work when only Z changes. AngleBetweenPositions uses a tangeant with 2 arguments to avoid this issue, you can use AngleBetweenPositions in your formula.
  • Users will expect PointInsideA3DObject to pick the objects (which is only possible with JS)
  • Have you tried my previous suggestion: "I guess intervals intersection can be checked with a simpler formula like this one: aMin < bMax and aMax > bMin" (Collision Between 3D Objects extension #1048 (comment))
  • Put3dObjectAroundPoint, shouldn't an object elevated with 90° be nearer to the screen (in the editor pov)?
  • I don't see the point of Put3dObjectAroundPointWithOrientation, if it were using Put3dObjectAroundPoint, it would only pass parameters to 3 actions without any formula.

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
Status: Needs changes
Development

Successfully merging this pull request may close these issues.

2 participants