Compass implementation for different needs in Godot Engine, written in GDScript.
This project is a Godot Engine addon that adds new CompassBar, Compass3D, and Compass2D Nodes in Editor. These new nodes make easy and fast Compass creation possible for 3D and 2D games. It is available under the terms of the MIT License.
- Search "Godot Compass" in the AssetLib
- Download and Install
- Enable: Projects Settings > Plugins > Status [Enable: True]
- Reload the project if you don't see the Compass Nodes
- Clone this repo or download as zip from matching branch
- Copy/Move the
res://addons/compass
directory to yourres://addons
directory - Do step 3 and 4 from Method One
- Make sure you have removed all the attached Compass Nodes from Scenes.
- Delete the
res://addons/compass
directory from your project. Make sure to delete it using the Godot editor instead of your default file system program.
- Search and add CompassBar/Compass3D/Compass2D using Ctrl-A or Add Node button
- Assign the Parent property for rotation calculation, Parent is the rotating node
Note: To use CompassBar and Compass2D for 2d games, if you are not rotating the node, provide the parent_property_for_current_direction
, for example save your current direction in a var dir
and type this in the property.
Property | Explanation | Default |
---|---|---|
Parent | Rotating Node for calculation | None |
Mode | condition, which North Vector type to use ["3D", "2D"] | "3D" |
Parent Property For Current Direction | parent property defining current direction (Mode 2D only) | rotation |
Lerp Speed | Smoothing (0.01, 0.5) | 0.1 |
Shader Property | Explanation | Default |
---|---|---|
North | North offset in radians (0, 2*PI) | 0.0 (-Y for 2D, -Z for 3D) |
Property | Explanation | Default |
---|---|---|
North | Sets the north direction (-180, 180) | 0 (-Z) |
Parent | Rotating Node for calculation | None |
Custom Container Resource | change container mesh | container3d.mesh |
Custom needle Resource | change needle mesh | needle3d.mesh |
Lerp Speed | Smoothing (0.01, 0.5) | 0.1 |
Rotate Container | Check to Rotate Container instead of Needle | false |
Property | Explanation | Default |
---|---|---|
North | Sets the north direction (-180, 180) | 0 (-Y for 2D, -Z for 3D) |
Mode | condition, which North Vector type to use ["3D", "2D"] | "3D" |
Parent | Rotating Node for calculation | None |
Parent Property For Current Direction | parent property defining current direction (Mode 2D only) | global_rotation |
Custom Container ImageTexture | change container png | container2d.png |
Custom needle ImageTexture | change needle png | needle2d.png |
Lerp Speed | Smoothing (0.01, 0.5) | 0.1 |
Rotate Container | Check to rotate Container instead of Needle | false |
Example 2D
compass2d.mp4
Example 3D
compass3d.mp4
Check out the given example.tscn
for 3d games and example2d.tscn
for 2d games in example.