GDevelop-extensions
GDevelop-extensions copied to clipboard
Tools for 3D
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
- [X] I've followed all of the best practices.
- [X] I confirm that this extension can be integrated to this GitHub repository, distributed and MIT licensed.
- [X] 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
Extension file
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
A few loose ends that I missed will be fixed today, the example is missing some features that I forgot to add.
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 useAngleBetweenPositions
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" (https://github.com/GDevelopApp/GDevelop-extensions/pull/1048#issuecomment-1756373281)
-
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 usingPut3dObjectAroundPoint
, it would only pass parameters to 3 actions without any formula.