This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ported C# to Godot C++: "Coding Adventure: Hydraulic Erosion" by Sebastian Lague | |
class SebastionErosion { | |
public: | |
struct HeightAndGradient { | |
public: | |
float height; | |
float gradientX; | |
float gradientY; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
""" | |
@tool | |
extends Node2D | |
var particles: Array[RID] = [] ## particle RIDS | |
@export var particle_radius: float = 5.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
""" | |
@tool | |
extends Node2D | |
var particles: Array[RID] = [] ## particle RIDS | |
@export var particle_radius: float = 5.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
corrects flaws from: | |
https://docs.godotengine.org/en/stable/classes/class_audiostreamgenerator.html | |
""" | |
@tool | |
extends Node | |
var playback: AudioStreamGeneratorPlayback # Will hold the AudioStreamGeneratorPlayback. | |
@onready var sample_hz: float = $AudioStreamPlayer.stream.mix_rate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Godot; | |
using System; | |
// try this: | |
// https://graphics.stanford.edu/~mdfisher/Code/MarchingCubes/MarchingCubes.cpp ??? same port issue back to first? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## using chat gp, asked for python (this gives an egg shape wtf?) | |
## https://chat.openai.com/c/0269574d-acb5-4f88-ac65-0a2c27e016df | |
static func get_keppler_position(semi_major_axis: float = 8.0, eccentricity: float = 0.9, theta: float = 0.0) -> Vector3: | |
var semi_minor_axis: float = semi_major_axis * sqrt(1.0 - eccentricity**2) # Calculate the semi-minor axis | |
var pos: Vector3 = Vector3(semi_major_axis * cos(theta), 0.0, semi_minor_axis * sin(theta)) | |
var rotation_angle = atan2(pos.z, pos.x) | |
## this but from chat gp, it doesn't seem a pure rotation, it seems to transform the parametric to keppler | |
pos = Vector3( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import numpy as np | |
def plot_kepler_orbit(semi_major_axis, eccentricity, num_points=1000): | |
# Calculate the semi-minor axis | |
semi_minor_axis = semi_major_axis * np.sqrt(1 - eccentricity**2) | |
# Generate theta values (angle from the positive x-axis) | |
theta = np.linspace(0, 2*np.pi, num_points) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## get existing or create new child node, works in tool mode to show in editor | |
static func get_or_create_child(_parent, _name, type = Node3D) -> Node: | |
var child = _parent.get_node_or_null(_name) | |
if not child: | |
child = type.new() | |
child.name = _name | |
_parent.add_child(child) | |
if Engine.is_editor_hint(): # if in editor we need to do this to show in editor | |
child.set_owner(_parent.get_tree().edited_scene_root) # new, allows static | |
return child |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# function that takes array of Vector3, returns a spline between them (as a Curve3D) | |
static func spline_positions_to_curve(marker_positions: Array, curve_strength: float) -> Curve3D: | |
var curve3D: Curve3D = Curve3D.new() | |
for i in marker_positions.size(): | |
var pos = marker_positions[i] # curve pos |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
FINISHED 03/12/2022 | |
HUGE drag drop modue, supports dragging cards about and throws signals | |
if set to check depth as 1, stacks of cards will become one object, no bugs! | |
check depth 2 allows dragging cards out of packs, is buggy still | |
NewerOlder