├── .gitignore
├── GodotVisionExample.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ ├── IDEWorkspaceChecks.plist
│ │ └── swiftpm
│ │ └── Package.resolved
└── xcshareddata
│ └── xcschemes
│ └── GodotVisionExample.xcscheme
├── GodotVisionExample
├── Assets.xcassets
│ ├── AccentColor.colorset
│ │ └── Contents.json
│ └── Contents.json
├── Controls
│ └── HandJoystick.swift
├── GodotVisionExampleApp.swift
├── ImmersiveView.swift
├── Info.plist
├── Preview Content
│ └── Preview Assets.xcassets
│ │ └── Contents.json
├── Utilities
│ ├── GodotInput.swift
│ ├── HandTracking.swift
│ ├── RealityKitToolbox.swift
│ └── ScenePhaseWatcher.swift
└── Views
│ ├── ExampleScenesBrowser.swift
│ └── GodotVisionSettingsView.swift
├── Godot_Project
├── .gitignore
├── addons
│ ├── godot-jolt
│ │ ├── LICENSE.txt
│ │ ├── THIRDPARTY.txt
│ │ ├── godot-jolt.gdextension
│ │ ├── macos
│ │ │ └── godot-jolt_macos_editor.framework
│ │ │ │ ├── Resources
│ │ │ │ ├── Versions
│ │ │ │ ├── 0.14.0
│ │ │ │ │ ├── Resources
│ │ │ │ │ │ └── Info.plist
│ │ │ │ │ └── godot-jolt_macos_editor
│ │ │ │ └── Current
│ │ │ │ └── godot-jolt_macos_editor
│ │ └── visionos
│ │ │ ├── godot-jolt_visionos.framework
│ │ │ ├── Info.plist
│ │ │ └── godot-jolt_visionos
│ │ │ └── godot-jolt_visionos_simulator.framework
│ │ │ ├── Info.plist
│ │ │ └── godot-jolt_visionos_simulator
│ └── godot_vision
│ │ ├── GodotVision_autoload.gd
│ │ ├── GodotVision_autoload.tscn
│ │ ├── SharePlay.gd
│ │ ├── VisionVolumeCamera.tscn
│ │ ├── auto_join_shareplay.gd
│ │ ├── godot_vision.gd
│ │ ├── plugin.cfg
│ │ ├── rk_audio_stream_player_3d.gd
│ │ └── vision_volume_camera.gd
├── examples
│ ├── common
│ │ ├── environments
│ │ │ └── default.tres
│ │ ├── materials
│ │ │ ├── brown.tres
│ │ │ ├── green.tres
│ │ │ └── grey.tres
│ │ └── scripts
│ │ │ ├── Rotater.gd
│ │ │ ├── auto_play_anim.gd
│ │ │ ├── draggable.gd
│ │ │ ├── example_mover.gd
│ │ │ ├── free_look_camera.gd
│ │ │ ├── game_character.gd
│ │ │ ├── global.gd
│ │ │ ├── magnifiable.gd
│ │ │ ├── play_sound_button.gd
│ │ │ ├── rotateable.gd
│ │ │ └── tower_enemy.gd
│ ├── csg
│ │ ├── csg.tscn
│ │ └── example_rotater.gd
│ ├── hello
│ │ ├── Mage.glb
│ │ ├── Mage.glb.import
│ │ ├── Mage_mage_texture.png
│ │ ├── Mage_mage_texture.png.import
│ │ ├── change_text_on_drag.gd
│ │ ├── example_godot_vision_scene.tscn
│ │ ├── models
│ │ │ └── godot_logo
│ │ │ │ ├── blinking.gd
│ │ │ │ ├── license.txt
│ │ │ │ ├── scene.bin
│ │ │ │ ├── scene.gltf
│ │ │ │ └── scene.gltf.import
│ │ ├── prefabs
│ │ │ ├── character_meshes.tscn
│ │ │ └── tower_enemy.tscn
│ │ ├── respawn_button.gd
│ │ ├── respawn_callback.gd
│ │ ├── sound
│ │ │ ├── moo.mp3
│ │ │ └── moo.mp3.import
│ │ └── textures
│ │ │ ├── checker.jpg
│ │ │ └── checker.jpg.import
│ ├── joints
│ │ ├── entities
│ │ │ ├── cone_twist
│ │ │ │ └── cone_twist.tscn
│ │ │ ├── hinge
│ │ │ │ └── hinge.tscn
│ │ │ ├── pin
│ │ │ │ └── pin.tscn
│ │ │ ├── rail
│ │ │ │ └── rail.tscn
│ │ │ ├── six_dof
│ │ │ │ └── six_dof.tscn
│ │ │ ├── slider
│ │ │ │ └── slider.tscn
│ │ │ └── spinner
│ │ │ │ └── spinner.tscn
│ │ └── joints.tscn
│ ├── kenney_platformer
│ │ ├── README.md
│ │ ├── meshes
│ │ │ ├── dust.res
│ │ │ └── dust.res.depren
│ │ ├── models
│ │ │ ├── Textures
│ │ │ │ ├── colormap.png
│ │ │ │ └── colormap.png.import
│ │ │ ├── character.glb
│ │ │ ├── character.glb.import
│ │ │ ├── cloud.glb
│ │ │ ├── cloud.glb.import
│ │ │ ├── coin.glb
│ │ │ ├── coin.glb.import
│ │ │ ├── dust.glb
│ │ │ ├── dust.glb.import
│ │ │ ├── flag.glb
│ │ │ ├── flag.glb.import
│ │ │ ├── grass-small.glb
│ │ │ ├── grass-small.glb.import
│ │ │ ├── grass.glb
│ │ │ ├── grass.glb.import
│ │ │ ├── platform-falling.glb
│ │ │ ├── platform-falling.glb.import
│ │ │ ├── platform-grass-large-round.glb
│ │ │ ├── platform-grass-large-round.glb.import
│ │ │ ├── platform-large.glb
│ │ │ ├── platform-large.glb.import
│ │ │ ├── platform-medium.glb
│ │ │ ├── platform-medium.glb.import
│ │ │ ├── platform.glb
│ │ │ └── platform.glb.import
│ │ ├── objects
│ │ │ ├── character.tscn
│ │ │ ├── cloud.gd
│ │ │ ├── cloud.tscn
│ │ │ ├── coin.gd
│ │ │ ├── coin.tscn
│ │ │ ├── platform.tscn
│ │ │ ├── platform_falling.gd
│ │ │ ├── platform_falling.tscn
│ │ │ ├── platform_grass_large_round.tscn
│ │ │ ├── platform_medium.tscn
│ │ │ └── player.tscn
│ │ ├── scripts
│ │ │ ├── audio.gd
│ │ │ ├── hud.gd
│ │ │ ├── player.gd
│ │ │ └── view.gd
│ │ ├── sounds
│ │ │ ├── coin.ogg
│ │ │ ├── coin.ogg.import
│ │ │ ├── fall.ogg
│ │ │ ├── fall.ogg.import
│ │ │ ├── jump.ogg
│ │ │ ├── jump.ogg.import
│ │ │ ├── land.ogg
│ │ │ ├── land.ogg.import
│ │ │ ├── walking.ogg
│ │ │ ├── walking.ogg.import
│ │ │ └── walking.ogg.sfk
│ │ └── sprites
│ │ │ ├── blob_shadow.png
│ │ │ ├── blob_shadow.png.import
│ │ │ ├── coin.png
│ │ │ ├── coin.png.import
│ │ │ ├── particle.png
│ │ │ └── particle.png.import
│ ├── multiplayer_example
│ │ └── multiplayer_example.tscn
│ ├── physics_toy
│ │ ├── models
│ │ │ └── spring_rigged
│ │ │ │ ├── license.txt
│ │ │ │ ├── scene.bin
│ │ │ │ ├── scene.gltf
│ │ │ │ └── scene.gltf.import
│ │ ├── physics_toy.tscn
│ │ ├── prefabs
│ │ │ ├── ball.tscn
│ │ │ ├── diagonal_toggle_board.tscn
│ │ │ ├── emitter.tscn
│ │ │ ├── spring.tscn
│ │ │ └── water_wheel.tscn
│ │ ├── scripts
│ │ │ ├── Editor.gd
│ │ │ ├── PhysicsCollisionSound.gd
│ │ │ ├── RotationSound.gd
│ │ │ ├── ball.gd
│ │ │ ├── diagonal_toggle_board.gd
│ │ │ ├── emitter.gd
│ │ │ ├── out_of_bounds.gd
│ │ │ ├── spring.gd
│ │ │ ├── spring_test.gd
│ │ │ ├── tween_effect.gd
│ │ │ └── water_wheel.gd
│ │ └── sounds
│ │ │ ├── 108538__jfreem3__squeekywalkl.mp3
│ │ │ ├── 108538__jfreem3__squeekywalkl.mp3.import
│ │ │ ├── 163398__baryy__squeeky-turn.mp3
│ │ │ ├── 163398__baryy__squeeky-turn.mp3.import
│ │ │ ├── 332661__reitanna__big-thud.mp3
│ │ │ ├── 332661__reitanna__big-thud.mp3.import
│ │ │ ├── 540788__magnuswaker__boing-1.mp3
│ │ │ ├── 540788__magnuswaker__boing-1.mp3.import
│ │ │ ├── 683101__florianreichelt__quick-woosh.mp3
│ │ │ ├── 683101__florianreichelt__quick-woosh.mp3.import
│ │ │ ├── 71774__lg__switch-22.mp3
│ │ │ └── 71774__lg__switch-22.mp3.import
│ ├── rigged_models
│ │ ├── example_rigged_models.tscn
│ │ └── models
│ │ │ └── low_poly_alpaca
│ │ │ ├── license.txt
│ │ │ ├── scene.bin
│ │ │ ├── scene.gltf
│ │ │ └── scene.gltf.import
│ ├── shapes
│ │ ├── entities
│ │ │ ├── box
│ │ │ │ └── box.tscn
│ │ │ ├── capsule
│ │ │ │ └── capsule.tscn
│ │ │ ├── concave_polygon
│ │ │ │ ├── concave_polygon.obj
│ │ │ │ ├── concave_polygon.obj.import
│ │ │ │ └── concave_polygon.tscn
│ │ │ ├── convex_polygon
│ │ │ │ ├── convex_polygon.obj
│ │ │ │ ├── convex_polygon.obj.import
│ │ │ │ └── convex_polygon.tscn
│ │ │ ├── cylinder
│ │ │ │ └── cylinder.tscn
│ │ │ ├── height_map
│ │ │ │ ├── height_map.gd
│ │ │ │ └── height_map.tscn
│ │ │ ├── separation_rays
│ │ │ │ └── separation_rays.tscn
│ │ │ └── sphere
│ │ │ │ └── sphere.tscn
│ │ └── shapes.tscn
│ └── soft_bodies
│ │ └── soft_bodies.tscn
├── project.godot
└── tests
│ ├── camera_rotation
│ ├── camera_rotation_example.tscn
│ └── test_camera_rotation.gd
│ ├── csg_polygon_test.tscn
│ ├── drag
│ └── drag_example.tscn
│ ├── materials
│ └── materials.tscn
│ └── physics_soft_body
│ └── example_physics_soft_body.tscn
├── LICENSE
├── README.md
├── docs
└── screenshot1.jpg
└── scripts
└── copy_bundle_resources
/.gitignore:
--------------------------------------------------------------------------------
1 | Packages/RealityKitContent/.swiftpm/xcode/xcuserdata
2 | .DS_Store
3 | .DS_Store
4 | playground.xcodeproj/project.xcworkspace/xcuserdata
5 | playground.xcodeproj/xcuserdata
6 | build/
7 | GodotVisionExample.xcodeproj/project.xcworkspace/xcuserdata/*
8 | GodotVisionExample.xcodeproj/xcuserdata/*.xcuserdatad
9 |
--------------------------------------------------------------------------------
/GodotVisionExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/GodotVisionExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/GodotVisionExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved:
--------------------------------------------------------------------------------
1 | {
2 | "pins" : [
3 | {
4 | "identity" : "swift-argument-parser",
5 | "kind" : "remoteSourceControl",
6 | "location" : "https://github.com/apple/swift-argument-parser",
7 | "state" : {
8 | "revision" : "41982a3656a71c768319979febd796c6fd111d5c",
9 | "version" : "1.5.0"
10 | }
11 | },
12 | {
13 | "identity" : "swift-docc-plugin",
14 | "kind" : "remoteSourceControl",
15 | "location" : "https://github.com/swiftlang/swift-docc-plugin",
16 | "state" : {
17 | "revision" : "85e4bb4e1cd62cec64a4b8e769dcefdf0c5b9d64",
18 | "version" : "1.4.3"
19 | }
20 | },
21 | {
22 | "identity" : "swift-docc-symbolkit",
23 | "kind" : "remoteSourceControl",
24 | "location" : "https://github.com/swiftlang/swift-docc-symbolkit",
25 | "state" : {
26 | "revision" : "b45d1f2ed151d057b54504d653e0da5552844e34",
27 | "version" : "1.0.0"
28 | }
29 | },
30 | {
31 | "identity" : "swift-syntax",
32 | "kind" : "remoteSourceControl",
33 | "location" : "https://github.com/swiftlang/swift-syntax",
34 | "state" : {
35 | "revision" : "2bc86522d115234d1f588efe2bcb4ce4be8f8b82",
36 | "version" : "510.0.3"
37 | }
38 | }
39 | ],
40 | "version" : 2
41 | }
42 |
--------------------------------------------------------------------------------
/GodotVisionExample.xcodeproj/xcshareddata/xcschemes/GodotVisionExample.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
31 |
32 |
42 |
44 |
50 |
51 |
52 |
53 |
59 |
61 |
67 |
68 |
69 |
70 |
72 |
73 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/GodotVisionExample/Assets.xcassets/AccentColor.colorset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "colors" : [
3 | {
4 | "color" : {
5 | "color-space" : "srgb",
6 | "components" : {
7 | "alpha" : "1.000",
8 | "blue" : "0.573",
9 | "green" : "0.186",
10 | "red" : "1.000"
11 | }
12 | },
13 | "idiom" : "universal"
14 | },
15 | {
16 | "appearances" : [
17 | {
18 | "appearance" : "luminosity",
19 | "value" : "dark"
20 | }
21 | ],
22 | "color" : {
23 | "color-space" : "srgb",
24 | "components" : {
25 | "alpha" : "1.000",
26 | "blue" : "0.573",
27 | "green" : "0.186",
28 | "red" : "1.000"
29 | }
30 | },
31 | "idiom" : "universal"
32 | }
33 | ],
34 | "info" : {
35 | "author" : "xcode",
36 | "version" : 1
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/GodotVisionExample/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/GodotVisionExample/Controls/HandJoystick.swift:
--------------------------------------------------------------------------------
1 | // Created by Kevin Watters on 10/1/24.
2 |
3 | import simd
4 | import ARKit
5 |
6 | final class HandJoystick {
7 | enum Mode {
8 | case ThumbJoystick, HoldingInvisibleJoystick
9 | }
10 |
11 | var mode: Mode = .HoldingInvisibleJoystick
12 | var deadZoneRadians: Float = 0.15
13 |
14 | var activated: Bool = false
15 | var smoothedWP: simd_float3 = .zero
16 | var smoothedNormal: simd_float3 = .zero
17 |
18 | func checkNaNs() -> Bool {
19 | var foundNaN = false
20 | if smoothedWP.hasNaN { print("hasNaN: smoothedThumbWorldPos"); foundNaN = true }
21 | if smoothedNormal.hasNaN { print("hasNaN: smoothedThumbDirNormal"); foundNaN = true }
22 | return foundNaN
23 | }
24 |
25 | func update(handAnchor: HandAnchor, deltaTime: TimeInterval) {
26 | guard handAnchor.isTracked, let skel = handAnchor.handSkeleton else {
27 | activated = false
28 | return
29 | }
30 |
31 | let handOriginFromAnchorTransform = handAnchor.originFromAnchorTransform
32 | func worldPos(_ jointName: HandSkeleton.JointName) -> simd_float3 {
33 | matrix_multiply(handOriginFromAnchorTransform, skel.joint(jointName).anchorFromJointTransform).columns.3.xyz
34 | }
35 |
36 | let wristWP = worldPos(.forearmWrist)
37 |
38 | let fingerTips: [HandSkeleton.JointName] = [ .indexFingerTip, .middleFingerTip, .ringFingerTip, .littleFingerTip ]
39 | let deltas = fingerTips.map { wristWP - worldPos($0) }
40 | let T: Float = 0.16
41 | activated = deltas.allSatisfy { length($0) < T }
42 |
43 | let normalsDelta = deltaTime * 20
44 |
45 | if mode == .ThumbJoystick {
46 | let thumbTipWP = worldPos(.thumbTip)
47 | let thumbIntermediateTipWP = worldPos(.thumbIntermediateTip)
48 | let positionDelta = Float(deltaTime * 14.0) * (0.8 + distance(smoothedWP, thumbTipWP))
49 | let thumbPointDir = normalize(thumbTipWP - thumbIntermediateTipWP)
50 | smoothedNormal.mixTowards(thumbPointDir, t: normalsDelta)
51 | smoothedWP.mixTowards(thumbTipWP, t: positionDelta)
52 | } else if mode == .HoldingInvisibleJoystick {
53 | let wps = fingerTips.map { worldPos($0) }
54 | let vectors = (0..
2 |
3 |
4 |
5 | NSHandsTrackingUsageDescription
6 | Track your hands to control the game.
7 | UIApplicationSceneManifest
8 |
9 | UIApplicationPreferredDefaultSceneSessionRole
10 | UIWindowSceneSessionRoleVolumetricApplication
11 | UIApplicationSupportsMultipleScenes
12 |
13 | UISceneConfigurations
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/GodotVisionExample/Preview Content/Preview Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/GodotVisionExample/Utilities/GodotInput.swift:
--------------------------------------------------------------------------------
1 | // Created by Kevin Watters on 10/11/24.
2 |
3 | import SwiftGodot
4 | import simd
5 |
6 | func sendJoypadInput(_ leftAxis: simd_float2) {
7 | let JOY_FACTOR = 2.0
8 |
9 | // Left X axis
10 | let e = InputEventJoypadMotion()
11 | e.axis = JoyAxis.leftX
12 | e.axisValue = Double(leftAxis.x) * JOY_FACTOR
13 | Input.parseInputEvent(e)
14 |
15 | // Right X axis
16 | let e2 = InputEventJoypadMotion()
17 | e2.axis = JoyAxis.leftY
18 | e2.axisValue = Double(leftAxis.y) * JOY_FACTOR
19 | Input.parseInputEvent(e2)
20 | }
21 |
22 |
--------------------------------------------------------------------------------
/GodotVisionExample/Utilities/HandTracking.swift:
--------------------------------------------------------------------------------
1 | // Created by Kevin Watters on 10/11/24.
2 |
3 | import ARKit
4 | import UIKit
5 |
6 | final class HandTracking: ObservableObject {
7 | private let session = ARKitSession()
8 | private let provider = HandTrackingProvider()
9 | private var handJoystick = HandJoystick()
10 | private var sessionRunTask: Task? = nil
11 |
12 | var leftAxis: simd_float3 { get {
13 | if handJoystick.activated {
14 | return handJoystick.smoothedNormal
15 | } else {
16 | return .zero
17 | }
18 | }}
19 |
20 | func update(deltaTime: TimeInterval) {
21 | if provider.state == .running {
22 | let (leftHandAnchor, _) = provider.handAnchors(at: CACurrentMediaTime())
23 | if let leftHandAnchor {
24 | handJoystick.update(handAnchor: leftHandAnchor, deltaTime: deltaTime)
25 | }
26 | }
27 | }
28 |
29 | func setEnabled(_ enabled: Bool) {
30 | if enabled {
31 | if sessionRunTask == nil {
32 | sessionRunTask = Task {
33 | do {
34 | #if !targetEnvironment(simulator)
35 | print("starting ARKitSession...")
36 | try await session.run([provider])
37 | print("started ARKitSession")
38 | #endif
39 | } catch {
40 | print("ERROR starting ARKitSession:", error)
41 | }
42 | }
43 | }
44 | } else {
45 | handJoystick.activated = false
46 | sessionRunTask?.cancel()
47 | sessionRunTask = nil
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/GodotVisionExample/Utilities/ScenePhaseWatcher.swift:
--------------------------------------------------------------------------------
1 | // Created by Kevin Watters on 10/11/24.
2 |
3 | import SwiftUI
4 |
5 | struct ScenePhaseWatcher: ViewModifier {
6 | @Environment(\.scenePhase) private var enviornmentScenePhase
7 | @Binding var scenePhase: ScenePhase
8 |
9 | func body(content: Content) -> some View {
10 | content.onChange(of: enviornmentScenePhase) { oldValue, newValue in
11 | scenePhase = newValue
12 | }
13 | }
14 | }
15 |
16 | extension View {
17 | func readScenePhaseTo(_ scenePhase: Binding) -> some View {
18 | modifier(ScenePhaseWatcher(scenePhase: scenePhase))
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/GodotVisionExample/Views/GodotVisionSettingsView.swift:
--------------------------------------------------------------------------------
1 | // Created by Kevin Watters on 10/8/24.
2 |
3 | import SwiftUI
4 | import GodotVision
5 |
6 | struct GodotVisionSettingsView: View {
7 | @ObservedObject var godotVision: GodotVisionCoordinator
8 |
9 | var body: some View {
10 | Text("Physics FPS")
11 | Picker("Physics FPS", selection: $godotVision.physicsTicksPerSecond) {
12 | Text("30").tag(30)
13 | Text("60").tag(60)
14 | Text("90").tag(90)
15 | }.frame(width: 150).pickerStyle(.palette)
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Godot_Project/.gitignore:
--------------------------------------------------------------------------------
1 | .godot/
2 |
--------------------------------------------------------------------------------
/Godot_Project/addons/godot-jolt/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) Mikael Hermansson and Godot Jolt contributors.
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of
4 | this software and associated documentation files (the "Software"), to deal in
5 | the Software without restriction, including without limitation the rights to
6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7 | the Software, and to permit persons to whom the Software is furnished to do so,
8 | subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 |
--------------------------------------------------------------------------------
/Godot_Project/addons/godot-jolt/THIRDPARTY.txt:
--------------------------------------------------------------------------------
1 | Godot Jolt incorporates third-party material from the projects listed below.
2 |
3 | Godot Engine (https://github.com/godotengine/godot)
4 |
5 | Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md).
6 | Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.
7 |
8 | Permission is hereby granted, free of charge, to any person obtaining a copy
9 | of this software and associated documentation files (the "Software"), to
10 | deal in the Software without restriction, including without limitation the
11 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12 | sell copies of the Software, and to permit persons to whom the Software is
13 | furnished to do so, subject to the following conditions:
14 |
15 | The above copyright notice and this permission notice shall be included in
16 | all copies or substantial portions of the Software.
17 |
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 | IN THE SOFTWARE.
25 |
26 | godot-cpp (https://github.com/godot-jolt/godot-cpp)
27 |
28 | Copyright (c) 2017-present Godot Engine contributors.
29 | Copyright (c) 2022-present Mikael Hermansson.
30 |
31 | Permission is hereby granted, free of charge, to any person obtaining a copy
32 | of this software and associated documentation files (the "Software"), to
33 | deal in the Software without restriction, including without limitation the
34 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
35 | sell copies of the Software, and to permit persons to whom the Software is
36 | furnished to do so, subject to the following conditions:
37 |
38 | The above copyright notice and this permission notice shall be included in
39 | all copies or substantial portions of the Software.
40 |
41 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
42 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
43 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
44 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
45 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
46 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
47 | IN THE SOFTWARE.
48 |
49 | Jolt Physics (https://github.com/godot-jolt/jolt)
50 |
51 | Copyright (c) 2021 Jorrit Rouwe.
52 |
53 | Permission is hereby granted, free of charge, to any person obtaining a copy
54 | of this software and associated documentation files (the "Software"), to
55 | deal in the Software without restriction, including without limitation the
56 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
57 | sell copies of the Software, and to permit persons to whom the Software is
58 | furnished to do so, subject to the following conditions:
59 |
60 | The above copyright notice and this permission notice shall be included in
61 | all copies or substantial portions of the Software.
62 |
63 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
64 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
65 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
66 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
67 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
68 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
69 | IN THE SOFTWARE.
70 |
71 | mimalloc (https://github.com/godot-jolt/mimalloc)
72 |
73 | Copyright (c) 2018-2021 Microsoft Corporation, Daan Leijen.
74 |
75 | Permission is hereby granted, free of charge, to any person obtaining a copy
76 | of this software and associated documentation files (the "Software"), to
77 | deal in the Software without restriction, including without limitation the
78 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
79 | sell copies of the Software, and to permit persons to whom the Software is
80 | furnished to do so, subject to the following conditions:
81 |
82 | The above copyright notice and this permission notice shall be included in
83 | all copies or substantial portions of the Software.
84 |
85 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
86 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
87 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
88 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
89 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
90 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
91 | IN THE SOFTWARE.
92 |
--------------------------------------------------------------------------------
/Godot_Project/addons/godot-jolt/godot-jolt.gdextension:
--------------------------------------------------------------------------------
1 | [godot-jolt]
2 | version = "0.14.0-dev"
3 | build = "9b57831329"
4 |
5 | [configuration]
6 |
7 | entry_symbol = "godot_jolt_main"
8 | compatibility_minimum = "4.3"
9 | compatibility_maximum = "4.3"
10 |
11 | [libraries]
12 |
13 | windows.release.single.x86_64 = "windows/godot-jolt_windows-x64.dll"
14 | windows.debug.single.x86_64 = "windows/godot-jolt_windows-x64_editor.dll"
15 |
16 | windows.release.single.x86_32 = "windows/godot-jolt_windows-x86.dll"
17 | windows.debug.single.x86_32 = "windows/godot-jolt_windows-x86_editor.dll"
18 |
19 | linux.release.single.x86_64 = "linux/godot-jolt_linux-x64.so"
20 | linux.debug.single.x86_64 = "linux/godot-jolt_linux-x64_editor.so"
21 |
22 | linux.release.single.x86_32 = "linux/godot-jolt_linux-x86.so"
23 | linux.debug.single.x86_32 = "linux/godot-jolt_linux-x86_editor.so"
24 |
25 | macos.release.single = "macos/godot-jolt_macos.framework"
26 | macos.debug.single = "macos/godot-jolt_macos_editor.framework"
27 |
28 | ios.release.single = "visionos/godot-jolt_visionos.framework"
29 | ios.release.single.simulator = "visionos/godot-jolt_visionos_simulator.framework"
30 | ios.debug.single = "visionos/godot-jolt_visionos.framework"
31 | ios.debug.single.simulator = "visionos/godot-jolt_visionos_editor_simulator.framework"
32 |
33 | android.release.single.arm64 = "android/libgodot-jolt_android-arm64.so"
34 | android.debug.single.arm64 = "android/libgodot-jolt_android-arm64_editor.so"
35 |
36 | android.release.single.arm32 = "android/libgodot-jolt_android-arm32.so"
37 | android.debug.single.arm32 = "android/libgodot-jolt_android-arm32_editor.so"
38 |
39 | android.release.single.x86_64 = "android/libgodot-jolt_android-x64.so"
40 | android.debug.single.x86_64 = "android/libgodot-jolt_android-x64_editor.so"
41 |
42 | android.release.single.x86_32 = "android/libgodot-jolt_android-x86.so"
43 | android.debug.single.x86_32 = "android/libgodot-jolt_android-x86_editor.so"
44 |
--------------------------------------------------------------------------------
/Godot_Project/addons/godot-jolt/macos/godot-jolt_macos_editor.framework/Resources:
--------------------------------------------------------------------------------
1 | Versions/Current/Resources
--------------------------------------------------------------------------------
/Godot_Project/addons/godot-jolt/macos/godot-jolt_macos_editor.framework/Versions/0.14.0/Resources/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleInfoDictionaryVersion
6 | 6.0
7 | CFBundleDevelopmentRegion
8 | en
9 | CFBundleExecutable
10 | godot-jolt_macos_editor
11 | CFBundleName
12 | Godot Jolt
13 | CFBundleDisplayName
14 | Godot Jolt
15 | CFBundleIdentifier
16 | org.godot-jolt.godot-jolt
17 | NSHumanReadableCopyright
18 | Copyright (c) Mikael Hermansson and Godot Jolt contributors.
19 | CFBundleVersion
20 | 0.14.0
21 | CFBundleShortVersionString
22 | 0.14.0
23 | CFBundlePackageType
24 | FMWK
25 | CFBundleSupportedPlatforms
26 |
27 | MacOSX
28 |
29 | CSResourcesFileMapped
30 |
31 | DTPlatformName
32 | macosx
33 | LSMinimumSystemVersion
34 | 10.12
35 |
36 |
37 |
--------------------------------------------------------------------------------
/Godot_Project/addons/godot-jolt/macos/godot-jolt_macos_editor.framework/Versions/0.14.0/godot-jolt_macos_editor:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/addons/godot-jolt/macos/godot-jolt_macos_editor.framework/Versions/0.14.0/godot-jolt_macos_editor
--------------------------------------------------------------------------------
/Godot_Project/addons/godot-jolt/macos/godot-jolt_macos_editor.framework/Versions/Current:
--------------------------------------------------------------------------------
1 | 0.14.0
--------------------------------------------------------------------------------
/Godot_Project/addons/godot-jolt/macos/godot-jolt_macos_editor.framework/godot-jolt_macos_editor:
--------------------------------------------------------------------------------
1 | Versions/Current/godot-jolt_macos_editor
--------------------------------------------------------------------------------
/Godot_Project/addons/godot-jolt/visionos/godot-jolt_visionos.framework/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleInfoDictionaryVersion
6 | 6.0
7 | CFBundleDevelopmentRegion
8 | en
9 | CFBundleExecutable
10 | godot-jolt_visionos
11 | CFBundleName
12 | Godot Jolt
13 | CFBundleDisplayName
14 | Godot Jolt
15 | CFBundleIdentifier
16 | org.godot-jolt.godot-jolt
17 | NSHumanReadableCopyright
18 | Copyright (c) Mikael Hermansson and Godot Jolt contributors.
19 | CFBundleVersion
20 | 0.14.0
21 | CFBundleShortVersionString
22 | 0.14.0
23 | CFBundlePackageType
24 | FMWK
25 | CFBundleSupportedPlatforms
26 |
27 | MacOSX
28 |
29 | CSResourcesFileMapped
30 |
31 | DTPlatformName
32 | macosx
33 | LSMinimumSystemVersion
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/Godot_Project/addons/godot-jolt/visionos/godot-jolt_visionos.framework/godot-jolt_visionos:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/addons/godot-jolt/visionos/godot-jolt_visionos.framework/godot-jolt_visionos
--------------------------------------------------------------------------------
/Godot_Project/addons/godot-jolt/visionos/godot-jolt_visionos_simulator.framework/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleInfoDictionaryVersion
6 | 6.0
7 | CFBundleDevelopmentRegion
8 | en
9 | CFBundleExecutable
10 | godot-jolt_visionos_simulator
11 | CFBundleName
12 | Godot Jolt
13 | CFBundleDisplayName
14 | Godot Jolt
15 | CFBundleIdentifier
16 | org.godot-jolt.godot-jolt
17 | NSHumanReadableCopyright
18 | Copyright (c) Mikael Hermansson and Godot Jolt contributors.
19 | CFBundleVersion
20 | 0.14.0
21 | CFBundleShortVersionString
22 | 0.14.0
23 | CFBundlePackageType
24 | FMWK
25 | CFBundleSupportedPlatforms
26 |
27 | MacOSX
28 |
29 | CSResourcesFileMapped
30 |
31 | DTPlatformName
32 | macosx
33 | LSMinimumSystemVersion
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/Godot_Project/addons/godot-jolt/visionos/godot-jolt_visionos_simulator.framework/godot-jolt_visionos_simulator:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/addons/godot-jolt/visionos/godot-jolt_visionos_simulator.framework/godot-jolt_visionos_simulator
--------------------------------------------------------------------------------
/Godot_Project/addons/godot_vision/GodotVision_autoload.gd:
--------------------------------------------------------------------------------
1 | extends Node
2 | class_name GodotVision_autoload
3 |
4 | @onready var share_play: SharePlay = $SharePlay
5 | var scene_tree: SceneTree
6 |
7 |
8 | func running_on_vision():
9 | return OS.get_name() == "iOS" # TODO: godot will eventually report the correct OS here :)
10 |
11 | func _enter_tree():
12 | if !running_on_vision():
13 | scene_tree = get_tree()
14 | scene_tree.node_added.connect(_on_node_added)
15 |
16 | func _exit_tree():
17 | if !running_on_vision():
18 | scene_tree.node_added.disconnect(_on_node_added)
19 | scene_tree = null
20 |
21 | func _on_node_added(node: Node):
22 | if node.has_signal("spatial_drag"):
23 | var col := node as CollisionObject3D
24 | if col:
25 | _simulate_godot_vision_drag_signal(node)
26 | col.input_capture_on_drag = true
27 | else:
28 | printerr("Node with signal 'spatial_drag' is not CollisionObject3D")
29 |
30 | #
31 | # On mac, we simulate the 'drag' signal that gets called from RealityKit
32 | #
33 | func _simulate_godot_vision_drag_signal(node: CollisionObject3D):
34 | var ctx = {
35 | "dragging": false,
36 | "camera": null,
37 | "orig_position": Vector2.ZERO,
38 | "orig_transform": node.global_transform,
39 | "orig_event_pos": Vector3.ZERO,
40 | "last_motion_event_position": Vector2.ZERO,
41 | "sent_began": false
42 | }
43 |
44 | ctx["emit_event"] = func(ended: bool):
45 | var current_event_pos := (ctx["camera"] as Camera3D).project_position(ctx["last_motion_event_position"] as Vector2, ctx["length"])
46 | var world_space_pos := (ctx["orig_node_position"] as Vector3) + (current_event_pos - (ctx["orig_event_pos"] as Vector3))
47 | var transform := ctx["orig_transform"] as Transform3D
48 | transform.origin = world_space_pos
49 |
50 | var phase := "began"
51 | if ended:
52 | phase = "ended"
53 | else:
54 | if ctx["sent_began"]:
55 | phase = "changed"
56 | else:
57 | ctx["sent_began"] = true
58 |
59 | var params := {
60 | "global_transform": transform,
61 | "phase": phase
62 | }
63 |
64 | node.emit_signal("spatial_drag", params)
65 |
66 | node.input_event.connect(func(camera: Camera3D, event, position: Vector3, normal, shape_idx):
67 | ctx["camera"] = camera
68 | var buttonEvent := event as InputEventMouseButton
69 | if buttonEvent:
70 | if not ctx["dragging"] && buttonEvent.pressed:
71 | # start dragging
72 | ctx["dragging"] = true
73 | ctx["orig_node_position"] = node.global_position
74 | ctx["length"] = (camera.global_position - node.global_position).length() # No, use 'position' converted to global
75 | ctx["orig_event_pos"] = camera.project_position(buttonEvent.position, ctx["length"])
76 | ctx["last_motion_event_position"] = buttonEvent.position
77 |
78 | elif ctx["dragging"] and not buttonEvent.pressed:
79 | # stop dragging
80 | ctx["emit_event"].call(true)
81 | ctx["dragging"] = false
82 | ctx["orig_position"] = Vector3.ZERO
83 | ctx["camera"] = null
84 | ctx["sent_began"] = false
85 |
86 | var motionEvent := event as InputEventMouseMotion
87 | if motionEvent and motionEvent.button_mask & 1 and ctx["dragging"]:
88 | ctx["last_motion_event_position"] = motionEvent.position
89 | ctx["emit_event"].call(false)
90 | )
91 |
--------------------------------------------------------------------------------
/Godot_Project/addons/godot_vision/GodotVision_autoload.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=3 format=3 uid="uid://c5vucxnx28wt3"]
2 |
3 | [ext_resource type="Script" path="res://addons/godot_vision/GodotVision_autoload.gd" id="1_w221q"]
4 | [ext_resource type="Script" path="res://addons/godot_vision/SharePlay.gd" id="2_61mna"]
5 |
6 | [node name="GodotVision_autoload" type="Node"]
7 | script = ExtResource("1_w221q")
8 |
9 | [node name="SharePlay" type="Node" parent="."]
10 | script = ExtResource("2_61mna")
11 |
--------------------------------------------------------------------------------
/Godot_Project/addons/godot_vision/SharePlay.gd:
--------------------------------------------------------------------------------
1 | extends Node
2 | class_name SharePlay
3 |
4 | # called by GodotVision
5 | signal peer_connected(peer_id: String, player_info: Dictionary)
6 | signal peer_disconnected(peer_id)
7 | signal message_received(from_peer: String, message: Dictionary)
8 |
9 | # emitted by us to GodotVision
10 | signal join_activity()
11 |
12 | var automatically_share_input: bool = false
13 |
14 |
15 | func broadcast_message(message: Dictionary):
16 | pass
17 |
18 | func auto_join_activity():
19 | join_activity.emit()
20 |
--------------------------------------------------------------------------------
/Godot_Project/addons/godot_vision/VisionVolumeCamera.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=6 format=3 uid="uid://biunegs8tkvn0"]
2 |
3 | [ext_resource type="Script" path="res://addons/godot_vision/vision_volume_camera.gd" id="1_bqg8h"]
4 |
5 | [sub_resource type="BoxShape3D" id="BoxShape3D_t2vsb"]
6 | size = Vector3(18, 10, 15)
7 |
8 | [sub_resource type="PhysicalSkyMaterial" id="PhysicalSkyMaterial_6ppar"]
9 | sun_disk_scale = 21.2
10 | ground_color = Color(0.513726, 0.411765, 0.286275, 1)
11 | energy_multiplier = 5.5
12 |
13 | [sub_resource type="Sky" id="Sky_0pgy2"]
14 | sky_material = SubResource("PhysicalSkyMaterial_6ppar")
15 |
16 | [sub_resource type="Environment" id="Environment_x2d02"]
17 | background_mode = 2
18 | sky = SubResource("Sky_0pgy2")
19 | ambient_light_source = 3
20 | ambient_light_color = Color(1, 1, 1, 1)
21 |
22 | [node name="VisionVolumeCamera" type="Area3D"]
23 | input_ray_pickable = false
24 | monitoring = false
25 | monitorable = false
26 | script = ExtResource("1_bqg8h")
27 |
28 | [node name="CollisionShape3D" type="CollisionShape3D" parent="."]
29 | shape = SubResource("BoxShape3D_t2vsb")
30 |
31 | [node name="Camera3D" type="Camera3D" parent="."]
32 | transform = Transform3D(1, 0, 0, 0, 0.941852, 0.336027, 0, -0.336027, 0.941852, 0, 2.24739, 16.0572)
33 | environment = SubResource("Environment_x2d02")
34 |
--------------------------------------------------------------------------------
/Godot_Project/addons/godot_vision/auto_join_shareplay.gd:
--------------------------------------------------------------------------------
1 | extends Node3D
2 | class_name AutoJoinSharePlay
3 |
4 | @export var auto_join = true
5 | @export var auto_share_input = true
6 |
7 | func _ready():
8 | if auto_join:
9 | await get_tree().create_timer(0.5).timeout
10 | call_deferred("join")
11 |
12 | func join():
13 | var share_play := GodotVision.share_play
14 | if not share_play:
15 | return
16 |
17 | share_play.automatically_share_input = auto_share_input
18 | share_play.auto_join_activity()
19 |
20 |
--------------------------------------------------------------------------------
/Godot_Project/addons/godot_vision/godot_vision.gd:
--------------------------------------------------------------------------------
1 | @tool
2 | extends EditorPlugin
3 |
4 | const AUTOLOAD_NAME = "GodotVision"
5 |
6 | func _enter_tree():
7 | add_autoload_singleton(AUTOLOAD_NAME, "res://addons/godot_vision/GodotVision_autoload.tscn")
8 |
9 | func _exit_tree():
10 | remove_autoload_singleton(AUTOLOAD_NAME)
11 |
--------------------------------------------------------------------------------
/Godot_Project/addons/godot_vision/plugin.cfg:
--------------------------------------------------------------------------------
1 | [plugin]
2 |
3 | name="godot_vision"
4 | description="Custom nodes for creating Apple VisionOS content."
5 | author="Adam Watters and Kevin Watters"
6 | version="0.0.1"
7 | script="godot_vision.gd"
8 |
--------------------------------------------------------------------------------
/Godot_Project/addons/godot_vision/rk_audio_stream_player_3d.gd:
--------------------------------------------------------------------------------
1 | #
2 | #
3 | # THIS CLASS IS DEPRECATED--just use AudioStreamPlayer3D now.
4 | #
5 | #
6 |
7 | class_name RKAudioStreamPlayer3D
8 | extends AudioStreamPlayer3D
9 |
10 | signal on_play(node: AudioStreamPlayer3D)
11 | signal on_prepare(node: AudioStreamPlayer3D)
12 |
13 | @export var auto_prepare_resource: bool = true
14 |
15 | func _enter_tree():
16 | if auto_prepare_resource:
17 | on_prepare.emit(self)
18 |
19 | func play_rk(from_position: float = 0.0):
20 | on_play.emit(self)
21 | super.play(from_position)
22 |
--------------------------------------------------------------------------------
/Godot_Project/addons/godot_vision/vision_volume_camera.gd:
--------------------------------------------------------------------------------
1 | @tool
2 | extends Area3D
3 |
4 | func _ready():
5 | renamed.connect(func():
6 | if name != "VisionVolumeCamera":
7 | printerr("node must be named VisionVolumeCamera to be recognized by VisionOS.")
8 | else:
9 | print("VisionVolumeCamera name is correct.")
10 | )
11 |
12 | # don't do physics updates for this, since we're just using it for a cube reference
13 | monitorable = false
14 | monitoring = false
15 |
16 | func _add_debug_corners():
17 | var shape = $CollisionShape3D as CollisionShape3D
18 | if not shape:
19 | printerr("Expected $CollisionShape3D to be a CollisionShape3D")
20 | return
21 |
22 | var boxShape = shape.shape as BoxShape3D
23 | if not boxShape:
24 | printerr("Expected $CollisionShape3D.shape to be a BoxShape3D")
25 | return
26 |
27 | var material = StandardMaterial3D.new()
28 | var mesh = SphereMesh.new()
29 | mesh.radius = 0.2
30 | mesh.height = mesh.radius * 2
31 | mesh.material = material
32 |
33 | material.albedo_color = Color(1, 1, 0, 1)
34 | print("size", boxShape.size)
35 |
36 | var debugInst = MeshInstance3D.new()
37 | debugInst.mesh = mesh
38 | debugInst.can_process()
39 |
40 | var add_at_pos = func(pos: Vector3):
41 | var node = debugInst.duplicate()
42 | add_child(node)
43 | node.position = pos
44 |
45 | var half = boxShape.size * 0.5
46 |
47 | add_at_pos.call(Vector3(half.x, half.y, -half.z))
48 | add_at_pos.call(Vector3(half.x, -half.y, -half.z))
49 | add_at_pos.call(Vector3(-half.x, half.y, -half.z))
50 | add_at_pos.call(Vector3(-half.x, -half.y, -half.z))
51 |
52 | add_at_pos.call(Vector3(half.x, half.y, half.z))
53 | add_at_pos.call(Vector3(half.x, -half.y, half.z))
54 | add_at_pos.call(Vector3(-half.x, half.y, half.z))
55 | add_at_pos.call(Vector3(-half.x, -half.y, half.z))
56 |
--------------------------------------------------------------------------------
/Godot_Project/examples/common/environments/default.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Environment" load_steps=3 format=3 uid="uid://cgl5t5rlv6o6v"]
2 |
3 | [sub_resource type="PhysicalSkyMaterial" id="PhysicalSkyMaterial_yivqe"]
4 | rayleigh_color = Color(0.301961, 0.403922, 0.6, 1)
5 | mie_color = Color(0.690196, 0.729412, 0.811765, 1)
6 | ground_color = Color(0.690196, 0.729412, 0.811765, 1)
7 |
8 | [sub_resource type="Sky" id="Sky_tuy8d"]
9 | sky_material = SubResource("PhysicalSkyMaterial_yivqe")
10 |
11 | [resource]
12 | background_mode = 2
13 | sky = SubResource("Sky_tuy8d")
14 | tonemap_mode = 2
15 |
--------------------------------------------------------------------------------
/Godot_Project/examples/common/materials/brown.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="StandardMaterial3D" format=3 uid="uid://3dvxsth5fn3n"]
2 |
3 | [resource]
4 | cull_mode = 2
5 | shading_mode = 2
6 | specular_mode = 2
7 | albedo_color = Color(0.294118, 0.270588, 0.227451, 1)
8 | metallic_specular = 0.0
9 |
--------------------------------------------------------------------------------
/Godot_Project/examples/common/materials/green.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="StandardMaterial3D" format=3 uid="uid://ctm5wb05otmn4"]
2 |
3 | [resource]
4 | cull_mode = 2
5 | shading_mode = 2
6 | specular_mode = 2
7 | albedo_color = Color(0.435294, 0.643137, 0, 1)
8 | metallic_specular = 0.0
9 |
--------------------------------------------------------------------------------
/Godot_Project/examples/common/materials/grey.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="StandardMaterial3D" format=3 uid="uid://bd8s48i3httg2"]
2 |
3 | [resource]
4 | cull_mode = 2
5 | shading_mode = 2
6 | specular_mode = 2
7 | albedo_color = Color(0.2, 0.2, 0.2, 1)
8 | metallic_specular = 0.0
9 |
--------------------------------------------------------------------------------
/Godot_Project/examples/common/scripts/Rotater.gd:
--------------------------------------------------------------------------------
1 | extends Node3D
2 |
3 | @export var axis: Vector3 = Vector3.UP
4 | @export var speed: float = 1
5 | var origPos: Vector3 = Vector3.ZERO
6 | var t: float = 0
7 |
8 | func _ready():
9 | origPos = position
10 |
11 | func _process(delta):
12 | t += delta * speed
13 | rotation.x = sin(t * 4.2) * 0.18
14 | position.y = origPos.y + sin(t + get_instance_id()) + 0.5
15 |
--------------------------------------------------------------------------------
/Godot_Project/examples/common/scripts/auto_play_anim.gd:
--------------------------------------------------------------------------------
1 | extends Node3D
2 |
3 | @export var animation_name: String = ""
4 |
5 | @export var setLoopModeEnabled := true
6 | @export var setLoopMode := Animation.LOOP_LINEAR
7 |
8 | func _ready():
9 | var animation_players := find_children("*", "AnimationPlayer")
10 | if animation_players.size() == 0:
11 | printerr("no AnimationPlayer children found")
12 | return
13 |
14 | var anim: Animation
15 | var anim_player = animation_players[0] as AnimationPlayer
16 | if not anim_player:
17 | return
18 |
19 | if anim_player && animation_name && animation_name.length() > 0:
20 | anim = anim_player.get_animation(animation_name)
21 |
22 | if not anim:
23 | var anim_keys := anim_player.get_animation_list()
24 | if anim_keys.size() > 0:
25 | animation_name = anim_keys[0]
26 | if animation_name:
27 | anim = anim_player.get_animation(animation_name)
28 | if setLoopModeEnabled:
29 | anim.loop_mode = setLoopMode
30 | print("animation_name ", animation_name)
31 | anim_player.play(animation_name)
32 |
33 |
34 |
--------------------------------------------------------------------------------
/Godot_Project/examples/common/scripts/draggable.gd:
--------------------------------------------------------------------------------
1 | extends Node
2 |
3 | signal spatial_drag(Dictionary)
4 |
5 | func _ready():
6 | spatial_drag.connect(on_spatial_drag)
7 |
8 | func on_spatial_drag(params: Dictionary):
9 | # Move in 3D with the spatial gesture.
10 | self.global_transform = params['global_transform']
11 |
12 | # OR if you wanted to change just the position:
13 | # self.global_position = params['global_transform'].origin
14 |
15 | func _exit_tree():
16 | spatial_drag.disconnect(on_spatial_drag)
17 |
--------------------------------------------------------------------------------
/Godot_Project/examples/common/scripts/example_mover.gd:
--------------------------------------------------------------------------------
1 | #
2 | # Moves an object in a sine wave. Used in the example scenes.
3 | #
4 | class_name ExampleMover
5 | extends Node
6 |
7 | @export var scale: Vector3 = Vector3(1, 0, 0)
8 | @export var frequency: float = 1
9 | @export var target: Node3D
10 |
11 | var time: float = 0
12 | var orig_pos: Vector3 = Vector3.ZERO
13 |
14 | func _enter_tree():
15 | if target == null:
16 | target = get_parent() as Node3D
17 | if !target:
18 | printerr("ExampleMover: no target")
19 | set_process(false)
20 | else:
21 | orig_pos = target.position
22 |
23 | func _process(delta):
24 | # var prevTime := time
25 | time += delta
26 | target.position = orig_pos + sin(time * frequency) * scale
27 |
--------------------------------------------------------------------------------
/Godot_Project/examples/common/scripts/game_character.gd:
--------------------------------------------------------------------------------
1 | extends CharacterBody3D
2 |
3 | @onready var character_meshes = $character_meshes
4 |
5 | const MOVE_SPEED = 2
6 | const JUMP_FORCE = 30
7 | const GRAVITY = -9.8
8 | const MAX_FALL_SPEED = 30
9 |
10 | var y_velocity = 0
11 | var target: Area3D = null
12 |
13 | func _ready():
14 | pass
15 |
16 | func target_reached():
17 | target = null
18 | character_meshes.animation_player.play("RESET")
19 |
20 | func set_target(new_target: Area3D):
21 | if not target == null:
22 | target.active = false
23 | target = new_target
24 |
25 | func _process(delta):
26 | velocity = Vector3(0, -5, 0)
27 | if is_on_floor() and not target == null:
28 | character_meshes.animation_player.play("walk")
29 | var move_vector = (target.global_position - position).normalized()
30 | character_meshes.look_at(Vector3(target.global_position.x, position.y, target.global_position.z))
31 | velocity.x = move_vector.x * MOVE_SPEED
32 | velocity.z = move_vector.z * MOVE_SPEED
33 | move_and_slide()
34 |
--------------------------------------------------------------------------------
/Godot_Project/examples/common/scripts/global.gd:
--------------------------------------------------------------------------------
1 | extends Node
2 |
3 | func _input(event: InputEvent) -> void:
4 | if event is InputEventKey:
5 | if event.keycode == KEY_ESCAPE:
6 | get_tree().quit()
7 |
--------------------------------------------------------------------------------
/Godot_Project/examples/common/scripts/magnifiable.gd:
--------------------------------------------------------------------------------
1 | extends Node
2 |
3 | signal spatial_magnify(Dictionary)
4 |
5 | func _ready():
6 | spatial_magnify.connect(on_spatial_magnify)
7 |
8 | func on_spatial_magnify(params: Dictionary):
9 | self.global_transform = params["global_transform"]
10 |
11 | func _exit_tree():
12 | spatial_magnify.disconnect(on_spatial_magnify)
13 |
--------------------------------------------------------------------------------
/Godot_Project/examples/common/scripts/play_sound_button.gd:
--------------------------------------------------------------------------------
1 | extends StaticBody3D
2 |
3 | # Note! We use a special subclass of AudioStreamPlayer3D and its ".play_rk()"
4 | # method instead of ".play()" so that RealityKit can know to play the audio.
5 | @onready var audio_stream_player: AudioStreamPlayer3D = $AudioStreamPlayer3D
6 |
7 | func set_override_color(color):
8 | var mesh := $MeshInstance3D as MeshInstance3D
9 | var material: Material = null
10 | if color != null:
11 | material = StandardMaterial3D.new()
12 | material.albedo_color = color
13 | mesh.set_surface_override_material(0, material)
14 |
15 | func clear_override_color():
16 | var mesh := $MeshInstance3D as MeshInstance3D
17 | mesh.set_surface_override_material(0, null)
18 |
19 | func _on_input_event(_camera, event, _position, _normal, _shape_idx):
20 | if event is InputEventMouseButton:
21 | if event.pressed:
22 | audio_stream_player.play() # see note above
23 | set_override_color(Color.DARK_RED)
24 | else:
25 | clear_override_color()
26 |
27 |
--------------------------------------------------------------------------------
/Godot_Project/examples/common/scripts/rotateable.gd:
--------------------------------------------------------------------------------
1 | extends Node
2 |
3 | signal spatial_rotate3D(Dictionary)
4 |
5 | func _ready():
6 | spatial_rotate3D.connect(on_spatial_rotate3D)
7 |
8 | func on_spatial_rotate3D(params: Dictionary):
9 | self.global_transform = params['global_transform']
10 |
11 | func _exit_tree():
12 | spatial_rotate3D.disconnect(on_spatial_rotate3D)
13 |
--------------------------------------------------------------------------------
/Godot_Project/examples/common/scripts/tower_enemy.gd:
--------------------------------------------------------------------------------
1 | extends RigidBody3D
2 |
3 | @onready var anim_player = $character_meshes/AnimationPlayer as AnimationPlayer
4 |
5 | @onready var initial_global_position: Vector3 = self.global_position
6 |
7 | func _ready():
8 |
9 | anim_player.play("walk")
10 |
11 | func _process(_delta: float):
12 | # respawn the character if it gets knocked off screen
13 | if global_position.length() > 40:
14 | global_position = initial_global_position + Vector3(0, 7, 0)
15 | linear_velocity = Vector3.ZERO
16 | angular_velocity = Vector3.ZERO
17 |
--------------------------------------------------------------------------------
/Godot_Project/examples/csg/csg.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=3 format=3 uid="uid://d2dmyhc53bqy2"]
2 |
3 | [ext_resource type="PackedScene" uid="uid://biunegs8tkvn0" path="res://addons/godot_vision/VisionVolumeCamera.tscn" id="1_7nj2j"]
4 | [ext_resource type="Script" path="res://examples/csg/example_rotater.gd" id="2_ujl7s"]
5 |
6 | [node name="Example - CSG" type="Node3D"]
7 |
8 | [node name="VisionVolumeCamera" parent="." instance=ExtResource("1_7nj2j")]
9 |
10 | [node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
11 | transform = Transform3D(0.889974, 0.140082, -0.433962, 0.259297, 0.627371, 0.734283, 0.375115, -0.766018, 0.522021, 0, 0, 0)
12 |
13 | [node name="CSGSphere3D" type="CSGSphere3D" parent="."]
14 | radius = 2.57
15 | radial_segments = 30
16 | rings = 40
17 | script = ExtResource("2_ujl7s")
18 |
19 | [node name="CSGBox3D3" type="CSGBox3D" parent="CSGSphere3D"]
20 | transform = Transform3D(1, 0, 0, 0, 0.1362, 0.990681, 0, -0.990681, 0.1362, 0, -0.0160113, -2.11164)
21 | operation = 2
22 | size = Vector3(1, 1.66309, 4.3894)
23 |
24 | [node name="CSGBox3D" type="CSGBox3D" parent="CSGSphere3D"]
25 | transform = Transform3D(0.778411, 0.349992, -0.521135, -0.411454, 0.911427, -0.00247024, 0.474112, 0.216346, 0.853471, 1.07407, 1.45654, 1.84698)
26 | operation = 2
27 | size = Vector3(2.24805, 2.42334, 2.3291)
28 |
29 | [node name="CSGBox3D2" type="CSGBox3D" parent="CSGSphere3D"]
30 | transform = Transform3D(-0.339005, -0.154303, -0.465972, -0.24545, 0.543705, -0.0014736, 0.42508, 0.190888, -0.372467, -1.31939, -1.03592, 1.50636)
31 | operation = 2
32 | size = Vector3(2.24805, 2.42334, 2.3291)
33 |
--------------------------------------------------------------------------------
/Godot_Project/examples/csg/example_rotater.gd:
--------------------------------------------------------------------------------
1 | extends Node3D
2 | class_name ExampleRotater
3 |
4 | @export var amount: Vector3 = Vector3(0.5, 1.6, 0.3)
5 | @export var target: Node3D
6 |
7 | func _enter_tree():
8 | if target == null:
9 | target = self
10 |
11 | # Called every frame. 'delta' is the elapsed time since the previous frame.
12 | func _process(delta):
13 | target.rotation += amount * delta
14 |
--------------------------------------------------------------------------------
/Godot_Project/examples/hello/Mage.glb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/hello/Mage.glb
--------------------------------------------------------------------------------
/Godot_Project/examples/hello/Mage.glb.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="scene"
4 | importer_version=1
5 | type="PackedScene"
6 | uid="uid://cqvqorckixfi7"
7 | path="res://.godot/imported/Mage.glb-a47a454fd752397795b0b5a10bffbeb4.scn"
8 |
9 | [deps]
10 |
11 | source_file="res://examples/hello/Mage.glb"
12 | dest_files=["res://.godot/imported/Mage.glb-a47a454fd752397795b0b5a10bffbeb4.scn"]
13 |
14 | [params]
15 |
16 | nodes/root_type=""
17 | nodes/root_name=""
18 | nodes/apply_root_scale=true
19 | nodes/root_scale=1.0
20 | nodes/import_as_skeleton_bones=false
21 | meshes/ensure_tangents=true
22 | meshes/generate_lods=true
23 | meshes/create_shadow_meshes=true
24 | meshes/light_baking=1
25 | meshes/lightmap_texel_size=0.2
26 | meshes/force_disable_compression=false
27 | skins/use_named_skins=true
28 | animation/import=true
29 | animation/fps=30
30 | animation/trimming=false
31 | animation/remove_immutable_tracks=true
32 | animation/import_rest_as_RESET=false
33 | import_script/path=""
34 | _subresources={}
35 | gltf/naming_version=1
36 | gltf/embedded_image_handling=1
37 |
--------------------------------------------------------------------------------
/Godot_Project/examples/hello/Mage_mage_texture.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/hello/Mage_mage_texture.png
--------------------------------------------------------------------------------
/Godot_Project/examples/hello/Mage_mage_texture.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://urbbg3ltu4bo"
6 | path.s3tc="res://.godot/imported/Mage_mage_texture.png-d5c6fb339014e975c8c4e31c61009461.s3tc.ctex"
7 | path.etc2="res://.godot/imported/Mage_mage_texture.png-d5c6fb339014e975c8c4e31c61009461.etc2.ctex"
8 | metadata={
9 | "imported_formats": ["s3tc_bptc", "etc2_astc"],
10 | "vram_texture": true
11 | }
12 | generator_parameters={
13 | "md5": "4929e1d8419d602df7a7be89ce778863"
14 | }
15 |
16 | [deps]
17 |
18 | source_file="res://examples/hello/Mage_mage_texture.png"
19 | dest_files=["res://.godot/imported/Mage_mage_texture.png-d5c6fb339014e975c8c4e31c61009461.s3tc.ctex", "res://.godot/imported/Mage_mage_texture.png-d5c6fb339014e975c8c4e31c61009461.etc2.ctex"]
20 |
21 | [params]
22 |
23 | compress/mode=2
24 | compress/high_quality=false
25 | compress/lossy_quality=0.7
26 | compress/hdr_compression=1
27 | compress/normal_map=0
28 | compress/channel_pack=0
29 | mipmaps/generate=true
30 | mipmaps/limit=-1
31 | roughness/mode=0
32 | roughness/src_normal=""
33 | process/fix_alpha_border=true
34 | process/premult_alpha=false
35 | process/normal_map_invert_y=false
36 | process/hdr_as_srgb=false
37 | process/hdr_clamp_exposure=false
38 | process/size_limit=0
39 | detect_3d/compress_to=0
40 |
--------------------------------------------------------------------------------
/Godot_Project/examples/hello/change_text_on_drag.gd:
--------------------------------------------------------------------------------
1 | extends MeshInstance3D
2 |
3 | @onready var original_text: String = (mesh as TextMesh).text
4 |
5 | func set_label(label_text: String):
6 | (mesh as TextMesh).text = label_text
7 |
8 | func _on_drag_me_button_spatial_drag(evt: Dictionary):
9 | match evt.phase:
10 | "began":
11 | set_label("Wheee!!")
12 | "ended":
13 | set_label(original_text)
14 |
--------------------------------------------------------------------------------
/Godot_Project/examples/hello/models/godot_logo/blinking.gd:
--------------------------------------------------------------------------------
1 | extends Node3D
2 |
3 | func _ready() -> void:
4 | var eyes := find_child("Object_6") as Node3D
5 | if eyes:
6 | start_blinking(eyes)
7 |
8 | func start_blinking(eyes: Node3D):
9 | while is_inside_tree():
10 | await get_tree().create_timer(0.8 + randf() * 3).timeout
11 |
12 | var tween := get_tree().create_tween()
13 | tween.tween_property(eyes, "scale", Vector3(1, 0.05, 1), 0.08)
14 | await tween.finished
15 |
16 | var tween2 := get_tree().create_tween()
17 | tween2.tween_property(eyes, "scale", Vector3(1, 1, 1), 0.1)
18 | await tween2.finished
19 |
20 |
--------------------------------------------------------------------------------
/Godot_Project/examples/hello/models/godot_logo/license.txt:
--------------------------------------------------------------------------------
1 | Model Information:
2 | * title: Godot Logo
3 | * source: https://sketchfab.com/3d-models/godot-logo-239ac8e0cf364b7c889ce92224d38f78
4 | * author: Alex2911 (https://sketchfab.com/alex2911)
5 |
6 | Model License:
7 | * license type: CC-BY-4.0 (http://creativecommons.org/licenses/by/4.0/)
8 | * requirements: Author must be credited. Commercial use is allowed.
9 |
10 | If you use this 3D model in your project be sure to copy paste this credit wherever you share it:
11 | This work is based on "Godot Logo" (https://sketchfab.com/3d-models/godot-logo-239ac8e0cf364b7c889ce92224d38f78) by Alex2911 (https://sketchfab.com/alex2911) licensed under CC-BY-4.0 (http://creativecommons.org/licenses/by/4.0/)
--------------------------------------------------------------------------------
/Godot_Project/examples/hello/models/godot_logo/scene.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/hello/models/godot_logo/scene.bin
--------------------------------------------------------------------------------
/Godot_Project/examples/hello/models/godot_logo/scene.gltf.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="scene"
4 | importer_version=1
5 | type="PackedScene"
6 | uid="uid://kwottvmkrb6w"
7 | path="res://.godot/imported/scene.gltf-6286e22315e077ddaccb262e4a590e4e.scn"
8 |
9 | [deps]
10 |
11 | source_file="res://examples/hello/models/godot_logo/scene.gltf"
12 | dest_files=["res://.godot/imported/scene.gltf-6286e22315e077ddaccb262e4a590e4e.scn"]
13 |
14 | [params]
15 |
16 | nodes/root_type=""
17 | nodes/root_name=""
18 | nodes/apply_root_scale=true
19 | nodes/root_scale=1.0
20 | nodes/import_as_skeleton_bones=false
21 | meshes/ensure_tangents=true
22 | meshes/generate_lods=true
23 | meshes/create_shadow_meshes=true
24 | meshes/light_baking=1
25 | meshes/lightmap_texel_size=0.2
26 | meshes/force_disable_compression=false
27 | skins/use_named_skins=true
28 | animation/import=true
29 | animation/fps=30
30 | animation/trimming=false
31 | animation/remove_immutable_tracks=true
32 | animation/import_rest_as_RESET=false
33 | import_script/path=""
34 | _subresources={}
35 | gltf/naming_version=1
36 | gltf/embedded_image_handling=1
37 |
--------------------------------------------------------------------------------
/Godot_Project/examples/hello/prefabs/tower_enemy.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=4 format=3 uid="uid://bb6s0wxfewce6"]
2 |
3 | [ext_resource type="Script" path="res://examples/common/scripts/tower_enemy.gd" id="1_de4vf"]
4 | [ext_resource type="PackedScene" uid="uid://dlposbd8dupye" path="res://examples/hello/prefabs/character_meshes.tscn" id="2_digwm"]
5 |
6 | [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_tglj6"]
7 | radius = 0.75
8 | height = 2.6
9 |
10 | [node name="character" type="RigidBody3D"]
11 | transform = Transform3D(1, -3.48787e-16, 3.48787e-16, 3.48787e-16, 1, -3.48787e-16, -3.48787e-16, 3.48787e-16, 1, 2.08165e-12, 1.30854, 2.08165e-12)
12 | collision_layer = 4
13 | collision_mask = 9
14 | input_ray_pickable = false
15 | axis_lock_linear_z = true
16 | axis_lock_angular_x = true
17 | axis_lock_angular_y = true
18 | axis_lock_angular_z = true
19 | script = ExtResource("1_de4vf")
20 |
21 | [node name="character_shape" type="CollisionShape3D" parent="."]
22 | shape = SubResource("CapsuleShape3D_tglj6")
23 |
24 | [node name="character_meshes" parent="." instance=ExtResource("2_digwm")]
25 | transform = Transform3D(-3.61999e-06, 3.48788e-16, 1, 3.48787e-16, 1, -3.48787e-16, -1, 3.48786e-16, -3.61999e-06, 0, 0, 0)
26 | script = null
27 |
--------------------------------------------------------------------------------
/Godot_Project/examples/hello/respawn_button.gd:
--------------------------------------------------------------------------------
1 | class_name ClickableButton
2 | extends AnimatableBody3D
3 |
4 | signal on_clicked
5 |
6 | func _on_input_event(_camera, event, _position, _normal, _shape_idx):
7 | if event is InputEventMouseButton:
8 | if event.pressed:
9 | on_clicked.emit()
10 |
11 |
--------------------------------------------------------------------------------
/Godot_Project/examples/hello/respawn_callback.gd:
--------------------------------------------------------------------------------
1 | extends Node3D
2 |
3 | func _on_respawn_button_on_clicked() -> void:
4 | print("reloading current scene...")
5 | get_tree().reload_current_scene()
6 |
--------------------------------------------------------------------------------
/Godot_Project/examples/hello/sound/moo.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/hello/sound/moo.mp3
--------------------------------------------------------------------------------
/Godot_Project/examples/hello/sound/moo.mp3.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="mp3"
4 | type="AudioStreamMP3"
5 | uid="uid://xrv22x52g14l"
6 | path="res://.godot/imported/moo.mp3-76144dccd7d6f4186ec36158e314e2a7.mp3str"
7 |
8 | [deps]
9 |
10 | source_file="res://examples/hello/sound/moo.mp3"
11 | dest_files=["res://.godot/imported/moo.mp3-76144dccd7d6f4186ec36158e314e2a7.mp3str"]
12 |
13 | [params]
14 |
15 | loop=false
16 | loop_offset=0
17 | bpm=0
18 | beat_count=0
19 | bar_beats=4
20 |
--------------------------------------------------------------------------------
/Godot_Project/examples/hello/textures/checker.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/hello/textures/checker.jpg
--------------------------------------------------------------------------------
/Godot_Project/examples/hello/textures/checker.jpg.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://bmd0x5t1c2b3i"
6 | path.s3tc="res://.godot/imported/checker.jpg-e3383eb7401cf3e72c2c74fde14dece5.s3tc.ctex"
7 | path.etc2="res://.godot/imported/checker.jpg-e3383eb7401cf3e72c2c74fde14dece5.etc2.ctex"
8 | metadata={
9 | "imported_formats": ["s3tc_bptc", "etc2_astc"],
10 | "vram_texture": true
11 | }
12 |
13 | [deps]
14 |
15 | source_file="res://examples/hello/textures/checker.jpg"
16 | dest_files=["res://.godot/imported/checker.jpg-e3383eb7401cf3e72c2c74fde14dece5.s3tc.ctex", "res://.godot/imported/checker.jpg-e3383eb7401cf3e72c2c74fde14dece5.etc2.ctex"]
17 |
18 | [params]
19 |
20 | compress/mode=2
21 | compress/high_quality=false
22 | compress/lossy_quality=0.7
23 | compress/hdr_compression=1
24 | compress/normal_map=0
25 | compress/channel_pack=0
26 | mipmaps/generate=true
27 | mipmaps/limit=-1
28 | roughness/mode=0
29 | roughness/src_normal=""
30 | process/fix_alpha_border=true
31 | process/premult_alpha=false
32 | process/normal_map_invert_y=false
33 | process/hdr_as_srgb=false
34 | process/hdr_clamp_exposure=false
35 | process/size_limit=0
36 | detect_3d/compress_to=0
37 |
--------------------------------------------------------------------------------
/Godot_Project/examples/joints/entities/cone_twist/cone_twist.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=4 format=3 uid="uid://clbjmwhkbcqil"]
2 |
3 | [ext_resource type="Material" uid="uid://ctm5wb05otmn4" path="res://examples/common/materials/green.tres" id="1_h0ioh"]
4 |
5 | [sub_resource type="SphereShape3D" id="SphereShape3D_032dx"]
6 | radius = 0.2
7 |
8 | [sub_resource type="BoxShape3D" id="BoxShape3D_4u6ud"]
9 | size = Vector3(0.2, 0.2, 1)
10 |
11 | [node name="ConeTwist" type="Node3D"]
12 | metadata/_edit_group_ = true
13 |
14 | [node name="Anchor" type="StaticBody3D" parent="."]
15 | collision_layer = 0
16 | collision_mask = 0
17 | metadata/_edit_group_ = true
18 |
19 | [node name="Shape" type="CollisionShape3D" parent="Anchor"]
20 | shape = SubResource("SphereShape3D_032dx")
21 |
22 | [node name="Mesh" type="CSGSphere3D" parent="Anchor"]
23 | radius = 0.2
24 | radial_segments = 24
25 | rings = 12
26 | material = ExtResource("1_h0ioh")
27 |
28 | [node name="Joint" type="ConeTwistJoint3D" parent="Anchor"]
29 | node_a = NodePath("../../Segment1")
30 | node_b = NodePath("..")
31 | swing_span = 0.174533
32 | twist_span = 0.174533
33 |
34 | [node name="Segment1" type="RigidBody3D" parent="."]
35 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.5)
36 | metadata/_edit_group_ = true
37 |
38 | [node name="Shape_Beam" type="CollisionShape3D" parent="Segment1"]
39 | shape = SubResource("BoxShape3D_4u6ud")
40 |
41 | [node name="Mesh_Beam" type="CSGBox3D" parent="Segment1"]
42 | size = Vector3(0.2, 0.2, 1)
43 | material = ExtResource("1_h0ioh")
44 |
45 | [node name="Shape_Joint" type="CollisionShape3D" parent="Segment1"]
46 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.5)
47 | shape = SubResource("SphereShape3D_032dx")
48 |
49 | [node name="Mesh_Joint" type="CSGSphere3D" parent="Segment1"]
50 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.5)
51 | radius = 0.2
52 | radial_segments = 24
53 | rings = 12
54 | material = ExtResource("1_h0ioh")
55 |
56 | [node name="Joint" type="ConeTwistJoint3D" parent="Segment1"]
57 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.5)
58 | node_a = NodePath("..")
59 | node_b = NodePath("../../Segment2")
60 | swing_span = 0.174533
61 | twist_span = 0.174533
62 |
63 | [node name="Segment2" type="RigidBody3D" parent="."]
64 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -1.5)
65 | metadata/_edit_group_ = true
66 |
67 | [node name="Shape_Beam" type="CollisionShape3D" parent="Segment2"]
68 | shape = SubResource("BoxShape3D_4u6ud")
69 |
70 | [node name="Mesh_Beam" type="CSGBox3D" parent="Segment2"]
71 | size = Vector3(0.2, 0.2, 1)
72 | material = ExtResource("1_h0ioh")
73 |
74 | [node name="Shape_Joint" type="CollisionShape3D" parent="Segment2"]
75 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.4)
76 | shape = SubResource("SphereShape3D_032dx")
77 |
78 | [node name="Mesh_Joint" type="CSGSphere3D" parent="Segment2"]
79 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.4)
80 | radius = 0.2
81 | radial_segments = 24
82 | rings = 12
83 | material = ExtResource("1_h0ioh")
84 |
85 | [node name="Joint" type="ConeTwistJoint3D" parent="Segment2"]
86 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.5)
87 | node_a = NodePath("..")
88 | node_b = NodePath("../../Segment3")
89 | swing_span = 0.174533
90 | twist_span = 0.174533
91 |
92 | [node name="Segment3" type="RigidBody3D" parent="."]
93 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -2.5)
94 | metadata/_edit_group_ = true
95 |
96 | [node name="Shape_Beam" type="CollisionShape3D" parent="Segment3"]
97 | shape = SubResource("BoxShape3D_4u6ud")
98 |
99 | [node name="Mesh_Beam" type="CSGBox3D" parent="Segment3"]
100 | size = Vector3(0.2, 0.2, 1)
101 | material = ExtResource("1_h0ioh")
102 |
103 | [node name="Shape_Joint" type="CollisionShape3D" parent="Segment3"]
104 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.4)
105 | shape = SubResource("SphereShape3D_032dx")
106 |
107 | [node name="Mesh_Joint" type="CSGSphere3D" parent="Segment3"]
108 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.4)
109 | radius = 0.2
110 | radial_segments = 24
111 | rings = 12
112 | material = ExtResource("1_h0ioh")
113 |
--------------------------------------------------------------------------------
/Godot_Project/examples/joints/entities/hinge/hinge.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=6 format=3 uid="uid://byhekkfhi30nh"]
2 |
3 | [ext_resource type="Material" uid="uid://bd8s48i3httg2" path="res://examples/common/materials/grey.tres" id="1_6hjrb"]
4 | [ext_resource type="Material" uid="uid://ctm5wb05otmn4" path="res://examples/common/materials/green.tres" id="2_b5hp3"]
5 |
6 | [sub_resource type="SphereShape3D" id="SphereShape3D_0gjpd"]
7 | radius = 0.05
8 |
9 | [sub_resource type="PhysicsMaterial" id="PhysicsMaterial_0vs5y"]
10 | friction = 0.0
11 |
12 | [sub_resource type="BoxShape3D" id="BoxShape3D_ru8pf"]
13 | margin = 0.0
14 | size = Vector3(0.04, 1, 0.9)
15 |
16 | [node name="Hinge" type="Node3D"]
17 | metadata/_edit_group_ = true
18 |
19 | [node name="Anchor" type="StaticBody3D" parent="."]
20 | collision_layer = 0
21 | collision_mask = 0
22 | metadata/_edit_group_ = true
23 |
24 | [node name="Shape" type="CollisionShape3D" parent="Anchor"]
25 | shape = SubResource("SphereShape3D_0gjpd")
26 |
27 | [node name="Mesh_Joint" type="CSGCylinder3D" parent="Anchor"]
28 | transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0)
29 | radius = 0.05
30 | height = 1.0
31 | sides = 24
32 | material = ExtResource("1_6hjrb")
33 |
34 | [node name="Joint" type="HingeJoint3D" parent="Anchor"]
35 | node_a = NodePath("../../Sheet_Upper")
36 | node_b = NodePath("..")
37 | motor/enable = true
38 | motor/target_velocity = 3.0
39 | metadata/_edit_group_ = true
40 |
41 | [node name="Sheet_Upper" type="RigidBody3D" parent="."]
42 | physics_material_override = SubResource("PhysicsMaterial_0vs5y")
43 | metadata/_edit_group_ = true
44 |
45 | [node name="Shape" type="CollisionShape3D" parent="Sheet_Upper"]
46 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.5, 0)
47 | shape = SubResource("BoxShape3D_ru8pf")
48 |
49 | [node name="Mesh_Sheet" type="CSGBox3D" parent="Sheet_Upper"]
50 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.5, 0)
51 | size = Vector3(0.04, 1, 0.9)
52 | material = ExtResource("2_b5hp3")
53 |
54 | [node name="Mesh_Joint" type="CSGCylinder3D" parent="Sheet_Upper"]
55 | transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, -1, 0)
56 | radius = 0.05
57 | height = 1.0
58 | sides = 24
59 | material = ExtResource("1_6hjrb")
60 |
61 | [node name="Joint" type="HingeJoint3D" parent="Sheet_Upper"]
62 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0)
63 | node_a = NodePath("..")
64 | node_b = NodePath("../../Sheet_Middle")
65 | angular_limit/enable = true
66 | angular_limit/upper = 2.79253
67 | angular_limit/lower = -2.79253
68 | metadata/_edit_group_ = true
69 |
70 | [node name="Sheet_Middle" type="RigidBody3D" parent="."]
71 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0)
72 | physics_material_override = SubResource("PhysicsMaterial_0vs5y")
73 | metadata/_edit_group_ = true
74 |
75 | [node name="Shape" type="CollisionShape3D" parent="Sheet_Middle"]
76 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.5, 0)
77 | shape = SubResource("BoxShape3D_ru8pf")
78 |
79 | [node name="Mesh_Sheet" type="CSGBox3D" parent="Sheet_Middle"]
80 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.5, 0)
81 | size = Vector3(0.04, 1, 0.9)
82 | material = ExtResource("2_b5hp3")
83 |
84 | [node name="Mesh_Joint" type="CSGCylinder3D" parent="Sheet_Middle"]
85 | transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, -1, 0)
86 | radius = 0.05
87 | height = 1.0
88 | sides = 24
89 | material = ExtResource("1_6hjrb")
90 |
91 | [node name="Joint" type="HingeJoint3D" parent="Sheet_Middle"]
92 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0)
93 | node_a = NodePath("..")
94 | node_b = NodePath("../../Sheet_Lower")
95 | angular_limit/enable = true
96 | angular_limit/upper = 1.309
97 | angular_limit/lower = -1.309
98 | metadata/_edit_group_ = true
99 |
100 | [node name="Sheet_Lower" type="RigidBody3D" parent="."]
101 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -2, 0)
102 | physics_material_override = SubResource("PhysicsMaterial_0vs5y")
103 | metadata/_edit_group_ = true
104 |
105 | [node name="Shape" type="CollisionShape3D" parent="Sheet_Lower"]
106 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.5, 0)
107 | shape = SubResource("BoxShape3D_ru8pf")
108 |
109 | [node name="Mesh" type="CSGBox3D" parent="Sheet_Lower"]
110 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.5, 0)
111 | size = Vector3(0.04, 1, 0.9)
112 | material = ExtResource("2_b5hp3")
113 |
--------------------------------------------------------------------------------
/Godot_Project/examples/joints/entities/pin/pin.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=5 format=3 uid="uid://1qr0mfmdd78x"]
2 |
3 | [ext_resource type="Material" uid="uid://bd8s48i3httg2" path="res://examples/common/materials/grey.tres" id="1_twesm"]
4 | [ext_resource type="Material" uid="uid://ctm5wb05otmn4" path="res://examples/common/materials/green.tres" id="2_idrjo"]
5 |
6 | [sub_resource type="SphereShape3D" id="SphereShape3D_2svna"]
7 | radius = 0.075
8 |
9 | [sub_resource type="BoxShape3D" id="BoxShape3D_wm2kd"]
10 | size = Vector3(0.5, 0.5, 0.5)
11 |
12 | [node name="Pin" type="Node3D"]
13 | metadata/_edit_group_ = true
14 |
15 | [node name="Anchor" type="StaticBody3D" parent="."]
16 | collision_layer = 0
17 | collision_mask = 0
18 | metadata/_edit_group_ = true
19 |
20 | [node name="Shape" type="CollisionShape3D" parent="Anchor"]
21 | shape = SubResource("SphereShape3D_2svna")
22 |
23 | [node name="Mesh_Joint" type="CSGSphere3D" parent="Anchor"]
24 | radius = 0.075
25 | radial_segments = 24
26 | rings = 12
27 | material = ExtResource("1_twesm")
28 |
29 | [node name="Joint" type="PinJoint3D" parent="Anchor"]
30 | node_a = NodePath("..")
31 | node_b = NodePath("../../Box_Upper")
32 | metadata/_edit_group_ = true
33 |
34 | [node name="Box_Upper" type="RigidBody3D" parent="."]
35 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.5, 0)
36 | metadata/_edit_group_ = true
37 |
38 | [node name="Shape" type="CollisionShape3D" parent="Box_Upper"]
39 | shape = SubResource("BoxShape3D_wm2kd")
40 |
41 | [node name="Mesh_Connector_Upper" type="CSGCylinder3D" parent="Box_Upper"]
42 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.375, 0)
43 | radius = 0.05
44 | height = 0.25
45 | sides = 16
46 | material = ExtResource("1_twesm")
47 |
48 | [node name="Mesh_Box" type="CSGBox3D" parent="Box_Upper"]
49 | size = Vector3(0.5, 0.5, 0.5)
50 | material = ExtResource("2_idrjo")
51 |
52 | [node name="Mesh_Connector_Lower" type="CSGCylinder3D" parent="Box_Upper"]
53 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.375, 0)
54 | radius = 0.05
55 | height = 0.25
56 | sides = 16
57 | material = ExtResource("1_twesm")
58 |
59 | [node name="Mesh_Joint" type="CSGSphere3D" parent="Box_Upper"]
60 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.5, 0)
61 | radius = 0.075
62 | radial_segments = 24
63 | rings = 12
64 | material = ExtResource("1_twesm")
65 |
66 | [node name="Joint" type="PinJoint3D" parent="Box_Upper"]
67 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.5, 0)
68 | node_a = NodePath("..")
69 | node_b = NodePath("../../Box_Lower")
70 | exclude_nodes_from_collision = false
71 | metadata/_edit_group_ = true
72 |
73 | [node name="Box_Lower" type="RigidBody3D" parent="."]
74 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.5, 0)
75 | metadata/_edit_group_ = true
76 |
77 | [node name="Shape" type="CollisionShape3D" parent="Box_Lower"]
78 | shape = SubResource("BoxShape3D_wm2kd")
79 |
80 | [node name="Mesh_Connector" type="CSGCylinder3D" parent="Box_Lower"]
81 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.375, 0)
82 | radius = 0.05
83 | height = 0.25
84 | sides = 16
85 | material = ExtResource("1_twesm")
86 |
87 | [node name="Mesh_Box" type="CSGBox3D" parent="Box_Lower"]
88 | size = Vector3(0.5, 0.5, 0.5)
89 | material = ExtResource("2_idrjo")
90 |
--------------------------------------------------------------------------------
/Godot_Project/examples/joints/entities/rail/rail.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=5 format=3 uid="uid://22dn1k6ow04"]
2 |
3 | [ext_resource type="Material" uid="uid://bd8s48i3httg2" path="res://examples/common/materials/grey.tres" id="1_qchgo"]
4 |
5 | [sub_resource type="CylinderShape3D" id="CylinderShape3D_1wpvx"]
6 | height = 4.0
7 | radius = 0.05
8 |
9 | [sub_resource type="CylinderShape3D" id="CylinderShape3D_ssrqi"]
10 | height = 1.0
11 | radius = 0.05
12 |
13 | [sub_resource type="SphereShape3D" id="SphereShape3D_wdbvx"]
14 | radius = 0.075
15 |
16 | [node name="Rail" type="StaticBody3D"]
17 | metadata/_edit_group_ = true
18 |
19 | [node name="Shape_HRail" type="CollisionShape3D" parent="."]
20 | transform = Transform3D(-4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0, 1, 0, 1, 0)
21 | shape = SubResource("CylinderShape3D_1wpvx")
22 |
23 | [node name="Mesh" type="CSGCylinder3D" parent="Shape_HRail"]
24 | transform = Transform3D(-1, 8.74228e-08, 0, -8.74228e-08, -1, 0, 0, 0, 1, 0, 0, 0)
25 | radius = 0.05
26 | height = 4.0
27 | material = ExtResource("1_qchgo")
28 |
29 | [node name="Shape_VRail_Left" type="CollisionShape3D" parent="."]
30 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 0.5, 0)
31 | shape = SubResource("CylinderShape3D_ssrqi")
32 |
33 | [node name="Mesh" type="CSGCylinder3D" parent="Shape_VRail_Left"]
34 | radius = 0.05
35 | height = 1.0
36 | material = ExtResource("1_qchgo")
37 |
38 | [node name="Shape_VRail_Right" type="CollisionShape3D" parent="."]
39 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0.5, 0)
40 | shape = SubResource("CylinderShape3D_ssrqi")
41 |
42 | [node name="Mesh" type="CSGCylinder3D" parent="Shape_VRail_Right"]
43 | radius = 0.05
44 | height = 1.0
45 | material = ExtResource("1_qchgo")
46 |
47 | [node name="Shape_Ball_Left" type="CollisionShape3D" parent="."]
48 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 1, 0)
49 | shape = SubResource("SphereShape3D_wdbvx")
50 |
51 | [node name="Mesh" type="CSGSphere3D" parent="Shape_Ball_Left"]
52 | radius = 0.075
53 | material = ExtResource("1_qchgo")
54 |
55 | [node name="Shape_Ball_Right" type="CollisionShape3D" parent="."]
56 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 1, 0)
57 | shape = SubResource("SphereShape3D_wdbvx")
58 |
59 | [node name="Mesh" type="CSGSphere3D" parent="Shape_Ball_Right"]
60 | radius = 0.075
61 | material = ExtResource("1_qchgo")
62 |
--------------------------------------------------------------------------------
/Godot_Project/examples/joints/entities/six_dof/six_dof.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=4 format=3 uid="uid://hmestqg1dcbm"]
2 |
3 | [ext_resource type="Material" uid="uid://ctm5wb05otmn4" path="res://examples/common/materials/green.tres" id="1_ytr74"]
4 | [ext_resource type="PackedScene" uid="uid://22dn1k6ow04" path="res://examples/joints/entities/rail/rail.tscn" id="2_fex1v"]
5 |
6 | [sub_resource type="BoxShape3D" id="BoxShape3D_r68wj"]
7 |
8 | [node name="SixDOF" type="Node3D"]
9 | metadata/_edit_group_ = true
10 |
11 | [node name="Rail" parent="." instance=ExtResource("2_fex1v")]
12 |
13 | [node name="Box" type="RigidBody3D" parent="."]
14 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.19209e-07, 1, 0)
15 | metadata/_edit_group_ = true
16 |
17 | [node name="Shape" type="CollisionShape3D" parent="Box"]
18 | shape = SubResource("BoxShape3D_r68wj")
19 |
20 | [node name="Mesh" type="CSGBox3D" parent="Box"]
21 | material = ExtResource("1_ytr74")
22 |
23 | [node name="Joint" type="Generic6DOFJoint3D" parent="."]
24 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.19209e-07, 1, 0)
25 | node_a = NodePath("../Box")
26 | node_b = NodePath("../Rail")
27 | linear_limit_x/upper_distance = 1.3
28 | linear_limit_x/lower_distance = -1.3
29 | linear_motor_x/enabled = true
30 | linear_motor_x/target_velocity = 1.0
31 | linear_motor_x/force_limit = 1.0
32 | angular_limit_x/enabled = false
33 | angular_motor_x/enabled = true
34 | angular_motor_x/target_velocity = 5.0
35 | angular_motor_x/force_limit = 1.0
36 |
--------------------------------------------------------------------------------
/Godot_Project/examples/joints/entities/slider/slider.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=4 format=3 uid="uid://coe74njl0yehx"]
2 |
3 | [ext_resource type="Material" uid="uid://ctm5wb05otmn4" path="res://examples/common/materials/green.tres" id="1_uisoj"]
4 | [ext_resource type="PackedScene" uid="uid://22dn1k6ow04" path="res://examples/joints/entities/rail/rail.tscn" id="2_g088v"]
5 |
6 | [sub_resource type="BoxShape3D" id="BoxShape3D_7528f"]
7 |
8 | [node name="Slider" type="Node3D"]
9 | metadata/_edit_group_ = true
10 |
11 | [node name="Rail" parent="." instance=ExtResource("2_g088v")]
12 |
13 | [node name="Box" type="RigidBody3D" parent="."]
14 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.3, 1, 0)
15 | metadata/_edit_group_ = true
16 |
17 | [node name="Shape" type="CollisionShape3D" parent="Box"]
18 | shape = SubResource("BoxShape3D_7528f")
19 |
20 | [node name="Mesh" type="CSGBox3D" parent="Box"]
21 | material = ExtResource("1_uisoj")
22 |
23 | [node name="Joint" type="SliderJoint3D" parent="."]
24 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.3, 1, 0)
25 | node_a = NodePath("../Box")
26 | node_b = NodePath("../Rail")
27 | linear_limit/upper_distance = 0.0
28 | linear_limit/lower_distance = -2.6
29 |
--------------------------------------------------------------------------------
/Godot_Project/examples/joints/entities/spinner/spinner.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=6 format=3 uid="uid://d3p7n0bmr7xga"]
2 |
3 | [ext_resource type="Material" uid="uid://bd8s48i3httg2" path="res://examples/common/materials/grey.tres" id="1_akppi"]
4 | [ext_resource type="Material" uid="uid://ctm5wb05otmn4" path="res://examples/common/materials/green.tres" id="2_l4u3r"]
5 |
6 | [sub_resource type="CylinderShape3D" id="CylinderShape3D_rjt17"]
7 | height = 2.49
8 | radius = 0.05
9 |
10 | [sub_resource type="PhysicsMaterial" id="PhysicsMaterial_6phst"]
11 | friction = 0.0
12 |
13 | [sub_resource type="BoxShape3D" id="BoxShape3D_hmsk6"]
14 | size = Vector3(0.1, 2, 0.8)
15 |
16 | [node name="Spinner" type="Node3D"]
17 | metadata/_edit_group_ = true
18 |
19 | [node name="Hinge" type="StaticBody3D" parent="."]
20 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.245, 0)
21 | collision_layer = 0
22 | collision_mask = 0
23 |
24 | [node name="Shape" type="CollisionShape3D" parent="Hinge"]
25 | shape = SubResource("CylinderShape3D_rjt17")
26 | disabled = true
27 |
28 | [node name="Mesh" type="CSGCylinder3D" parent="Hinge"]
29 | radius = 0.05
30 | height = 2.49
31 | sides = 15
32 | material = ExtResource("1_akppi")
33 |
34 | [node name="Joint" type="HingeJoint3D" parent="Hinge"]
35 | transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0)
36 | node_a = NodePath("../../Sheet")
37 | node_b = NodePath("..")
38 |
39 | [node name="Sheet" type="RigidBody3D" parent="."]
40 | physics_material_override = SubResource("PhysicsMaterial_6phst")
41 |
42 | [node name="Shape" type="CollisionShape3D" parent="Sheet"]
43 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.5, -0.4)
44 | shape = SubResource("BoxShape3D_hmsk6")
45 |
46 | [node name="Mesh" type="CSGBox3D" parent="Sheet"]
47 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.5, -0.4)
48 | size = Vector3(0.1, 2, 0.8)
49 | material = ExtResource("2_l4u3r")
50 |
--------------------------------------------------------------------------------
/Godot_Project/examples/joints/joints.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=11 format=3 uid="uid://b5m5i0j4kfjaw"]
2 |
3 | [ext_resource type="Environment" uid="uid://cgl5t5rlv6o6v" path="res://examples/common/environments/default.tres" id="1_aom0t"]
4 | [ext_resource type="Script" path="res://examples/common/scripts/free_look_camera.gd" id="2_bxs0h"]
5 | [ext_resource type="Material" uid="uid://3dvxsth5fn3n" path="res://examples/common/materials/brown.tres" id="3_v06p4"]
6 | [ext_resource type="PackedScene" uid="uid://d3p7n0bmr7xga" path="res://examples/joints/entities/spinner/spinner.tscn" id="4_ln31s"]
7 | [ext_resource type="PackedScene" uid="uid://coe74njl0yehx" path="res://examples/joints/entities/slider/slider.tscn" id="5_02ote"]
8 | [ext_resource type="PackedScene" uid="uid://hmestqg1dcbm" path="res://examples/joints/entities/six_dof/six_dof.tscn" id="6_rodbc"]
9 | [ext_resource type="PackedScene" uid="uid://1qr0mfmdd78x" path="res://examples/joints/entities/pin/pin.tscn" id="7_mihtv"]
10 | [ext_resource type="PackedScene" uid="uid://clbjmwhkbcqil" path="res://examples/joints/entities/cone_twist/cone_twist.tscn" id="8_iy535"]
11 | [ext_resource type="PackedScene" uid="uid://byhekkfhi30nh" path="res://examples/joints/entities/hinge/hinge.tscn" id="9_ro1qy"]
12 |
13 | [sub_resource type="BoxShape3D" id="BoxShape3D_7618w"]
14 | size = Vector3(5, 1, 5)
15 |
16 | [node name="Joints" type="Node3D"]
17 |
18 | [node name="Environment" type="WorldEnvironment" parent="."]
19 | environment = ExtResource("1_aom0t")
20 |
21 | [node name="Sun" type="DirectionalLight3D" parent="."]
22 | transform = Transform3D(-0.825549, -0.544985, 0.146493, 0, 0.259587, 0.96572, -0.56433, 0.797249, -0.214302, 0, 0, 0)
23 | light_bake_mode = 0
24 | shadow_enabled = true
25 |
26 | [node name="Camera" type="Camera3D" parent="."]
27 | transform = Transform3D(-0.642788, -0.541675, 0.541675, 0, 0.707107, 0.707107, -0.766045, 0.45452, -0.45452, 4, 6, -4)
28 | current = true
29 | script = ExtResource("2_bxs0h")
30 |
31 | [node name="DebugGeometry" type="JoltDebugGeometry3D" parent="."]
32 | visible = false
33 |
34 | [node name="Floor" type="StaticBody3D" parent="."]
35 | metadata/_edit_group_ = true
36 |
37 | [node name="Shape" type="CollisionShape3D" parent="Floor"]
38 | shape = SubResource("BoxShape3D_7618w")
39 |
40 | [node name="Mesh" type="CSGBox3D" parent="Floor"]
41 | size = Vector3(5, 1, 5)
42 | material = ExtResource("3_v06p4")
43 |
44 | [node name="Spinner1" parent="." instance=ExtResource("4_ln31s")]
45 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.9, 0.5, -1)
46 |
47 | [node name="Joint" parent="Spinner1/Hinge" index="2"]
48 | motor/enable = true
49 | motor/target_velocity = -4.88692
50 | motor/max_impulse = 0.2
51 |
52 | [node name="Slider" parent="." instance=ExtResource("5_02ote")]
53 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, -2)
54 |
55 | [node name="Spinner2" parent="." instance=ExtResource("4_ln31s")]
56 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.9, 0.5, -1)
57 |
58 | [node name="Joint" parent="Spinner2/Hinge" index="2"]
59 | motor/enable = true
60 | motor/target_velocity = 4.88692
61 | motor/max_impulse = 0.2
62 |
63 | [node name="ConeTwist" parent="." instance=ExtResource("8_iy535")]
64 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.1, 3.5, 2.1)
65 |
66 | [node name="SixDOF" parent="." instance=ExtResource("6_rodbc")]
67 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.70552e-08, 0.5, 2)
68 |
69 | [node name="Spinner3" parent="." instance=ExtResource("4_ln31s")]
70 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.9, 0.5, 1)
71 |
72 | [node name="Joint" parent="Spinner3/Hinge" index="2"]
73 | motor/enable = true
74 | motor/target_velocity = 4.88692
75 | motor/max_impulse = 0.2
76 |
77 | [node name="Pin" parent="." instance=ExtResource("7_mihtv")]
78 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.9, 4, -0.6)
79 |
80 | [node name="Hinge" parent="." instance=ExtResource("9_ro1qy")]
81 | transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -0.5, 4, 0)
82 |
83 | [editable path="Spinner1"]
84 | [editable path="Spinner2"]
85 | [editable path="Spinner3"]
86 |
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 | # Starter Kit 3D Platformer
4 |
5 | This package includes a basic template for a 3D platformer game in Godot 4.3 (stable). Includes features like;
6 |
7 | - Character controller (with double jump)
8 | - Collectable coins and falling platforms
9 | - Camera controls (rotate, zoom)
10 | - Gamepad support
11 | - Sprites and 3D Models _(CC0 licensed)_
12 | - Sound effects _(CC0 licensed)_
13 |
14 | ### Screenshot
15 |
16 | 
17 |
18 | ### License
19 |
20 | MIT License
21 |
22 | Copyright (c) 2024 Kenney
23 |
24 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
25 |
26 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
27 |
28 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 |
30 | Assets included in this package (2D sprites, 3D models and sound effects) are [CC0 licensed](https://creativecommons.org/publicdomain/zero/1.0/)
31 |
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/meshes/dust.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/kenney_platformer/meshes/dust.res
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/meshes/dust.res.depren:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/kenney_platformer/meshes/dust.res.depren
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/models/Textures/colormap.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/kenney_platformer/models/Textures/colormap.png
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/models/Textures/colormap.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://0odt7cvj574e"
6 | path.bptc="res://.godot/imported/colormap.png-535efbc66258ba60793f2332173935ea.bptc.ctex"
7 | path.astc="res://.godot/imported/colormap.png-535efbc66258ba60793f2332173935ea.astc.ctex"
8 | metadata={
9 | "imported_formats": ["s3tc_bptc", "etc2_astc"],
10 | "vram_texture": true
11 | }
12 |
13 | [deps]
14 |
15 | source_file="res://examples/kenney_platformer/models/Textures/colormap.png"
16 | dest_files=["res://.godot/imported/colormap.png-535efbc66258ba60793f2332173935ea.bptc.ctex", "res://.godot/imported/colormap.png-535efbc66258ba60793f2332173935ea.astc.ctex"]
17 |
18 | [params]
19 |
20 | compress/mode=2
21 | compress/high_quality=true
22 | compress/lossy_quality=0.7
23 | compress/hdr_compression=1
24 | compress/normal_map=0
25 | compress/channel_pack=0
26 | mipmaps/generate=true
27 | mipmaps/limit=-1
28 | roughness/mode=0
29 | roughness/src_normal=""
30 | process/fix_alpha_border=true
31 | process/premult_alpha=false
32 | process/normal_map_invert_y=false
33 | process/hdr_as_srgb=false
34 | process/hdr_clamp_exposure=false
35 | process/size_limit=0
36 | detect_3d/compress_to=0
37 |
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/models/character.glb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/kenney_platformer/models/character.glb
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/models/cloud.glb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/kenney_platformer/models/cloud.glb
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/models/cloud.glb.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="scene"
4 | importer_version=1
5 | type="PackedScene"
6 | uid="uid://bsrmqj84lksd7"
7 | path="res://.godot/imported/cloud.glb-f45d4eff2189df20996efb9e3489d65b.scn"
8 |
9 | [deps]
10 |
11 | source_file="res://examples/kenney_platformer/models/cloud.glb"
12 | dest_files=["res://.godot/imported/cloud.glb-f45d4eff2189df20996efb9e3489d65b.scn"]
13 |
14 | [params]
15 |
16 | nodes/root_type="Node3D"
17 | nodes/root_name="Scene Root"
18 | nodes/apply_root_scale=true
19 | nodes/root_scale=1.0
20 | nodes/import_as_skeleton_bones=false
21 | meshes/ensure_tangents=true
22 | meshes/generate_lods=true
23 | meshes/create_shadow_meshes=true
24 | meshes/light_baking=1
25 | meshes/lightmap_texel_size=0.2
26 | meshes/force_disable_compression=false
27 | skins/use_named_skins=true
28 | animation/import=true
29 | animation/fps=30
30 | animation/trimming=false
31 | animation/remove_immutable_tracks=true
32 | animation/import_rest_as_RESET=false
33 | import_script/path=""
34 | _subresources={}
35 | gltf/naming_version=0
36 | gltf/embedded_image_handling=1
37 |
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/models/coin.glb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/kenney_platformer/models/coin.glb
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/models/coin.glb.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="scene"
4 | importer_version=1
5 | type="PackedScene"
6 | uid="uid://e64a4omgpcs"
7 | path="res://.godot/imported/coin.glb-019f65f285fdcd9069e4885bf4fd163b.scn"
8 |
9 | [deps]
10 |
11 | source_file="res://examples/kenney_platformer/models/coin.glb"
12 | dest_files=["res://.godot/imported/coin.glb-019f65f285fdcd9069e4885bf4fd163b.scn"]
13 |
14 | [params]
15 |
16 | nodes/root_type="Node3D"
17 | nodes/root_name="Scene Root"
18 | nodes/apply_root_scale=true
19 | nodes/root_scale=1.0
20 | nodes/import_as_skeleton_bones=false
21 | meshes/ensure_tangents=true
22 | meshes/generate_lods=true
23 | meshes/create_shadow_meshes=true
24 | meshes/light_baking=1
25 | meshes/lightmap_texel_size=0.2
26 | meshes/force_disable_compression=false
27 | skins/use_named_skins=true
28 | animation/import=true
29 | animation/fps=30
30 | animation/trimming=false
31 | animation/remove_immutable_tracks=true
32 | animation/import_rest_as_RESET=false
33 | import_script/path=""
34 | _subresources={}
35 | gltf/naming_version=0
36 | gltf/embedded_image_handling=1
37 |
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/models/dust.glb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/kenney_platformer/models/dust.glb
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/models/dust.glb.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="scene"
4 | importer_version=1
5 | type="PackedScene"
6 | uid="uid://brg64eln7l7wv"
7 | path="res://.godot/imported/dust.glb-2fde535b423e6ff4a507994dab809977.scn"
8 |
9 | [deps]
10 |
11 | source_file="res://examples/kenney_platformer/models/dust.glb"
12 | dest_files=["res://.godot/imported/dust.glb-2fde535b423e6ff4a507994dab809977.scn"]
13 |
14 | [params]
15 |
16 | nodes/root_type="Node3D"
17 | nodes/root_name="Scene Root"
18 | nodes/apply_root_scale=true
19 | nodes/root_scale=1.0
20 | nodes/import_as_skeleton_bones=false
21 | meshes/ensure_tangents=true
22 | meshes/generate_lods=true
23 | meshes/create_shadow_meshes=true
24 | meshes/light_baking=1
25 | meshes/lightmap_texel_size=0.2
26 | meshes/force_disable_compression=false
27 | skins/use_named_skins=true
28 | animation/import=true
29 | animation/fps=30
30 | animation/trimming=false
31 | animation/remove_immutable_tracks=true
32 | animation/import_rest_as_RESET=false
33 | import_script/path=""
34 | _subresources={}
35 | gltf/naming_version=0
36 | gltf/embedded_image_handling=1
37 |
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/models/flag.glb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/kenney_platformer/models/flag.glb
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/models/flag.glb.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="scene"
4 | importer_version=1
5 | type="PackedScene"
6 | uid="uid://dtjvjdjl8cs6e"
7 | path="res://.godot/imported/flag.glb-56ed342635318aaa88aa4d67391a391c.scn"
8 |
9 | [deps]
10 |
11 | source_file="res://examples/kenney_platformer/models/flag.glb"
12 | dest_files=["res://.godot/imported/flag.glb-56ed342635318aaa88aa4d67391a391c.scn"]
13 |
14 | [params]
15 |
16 | nodes/root_type="Node3D"
17 | nodes/root_name="Scene Root"
18 | nodes/apply_root_scale=true
19 | nodes/root_scale=1.0
20 | nodes/import_as_skeleton_bones=false
21 | meshes/ensure_tangents=true
22 | meshes/generate_lods=true
23 | meshes/create_shadow_meshes=true
24 | meshes/light_baking=1
25 | meshes/lightmap_texel_size=0.2
26 | meshes/force_disable_compression=false
27 | skins/use_named_skins=true
28 | animation/import=true
29 | animation/fps=30
30 | animation/trimming=false
31 | animation/remove_immutable_tracks=true
32 | animation/import_rest_as_RESET=false
33 | import_script/path=""
34 | _subresources={}
35 | gltf/naming_version=0
36 | gltf/embedded_image_handling=1
37 |
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/models/grass-small.glb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/kenney_platformer/models/grass-small.glb
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/models/grass-small.glb.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="scene"
4 | importer_version=1
5 | type="PackedScene"
6 | uid="uid://dkw27llxh1d4w"
7 | path="res://.godot/imported/grass-small.glb-c6e28b900ccdc1d3877bcc3867f08f38.scn"
8 |
9 | [deps]
10 |
11 | source_file="res://examples/kenney_platformer/models/grass-small.glb"
12 | dest_files=["res://.godot/imported/grass-small.glb-c6e28b900ccdc1d3877bcc3867f08f38.scn"]
13 |
14 | [params]
15 |
16 | nodes/root_type="Node3D"
17 | nodes/root_name="Scene Root"
18 | nodes/apply_root_scale=true
19 | nodes/root_scale=1.0
20 | nodes/import_as_skeleton_bones=false
21 | meshes/ensure_tangents=true
22 | meshes/generate_lods=true
23 | meshes/create_shadow_meshes=true
24 | meshes/light_baking=1
25 | meshes/lightmap_texel_size=0.2
26 | meshes/force_disable_compression=false
27 | skins/use_named_skins=true
28 | animation/import=true
29 | animation/fps=30
30 | animation/trimming=false
31 | animation/remove_immutable_tracks=true
32 | animation/import_rest_as_RESET=false
33 | import_script/path=""
34 | _subresources={}
35 | gltf/naming_version=0
36 | gltf/embedded_image_handling=1
37 |
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/models/grass.glb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/kenney_platformer/models/grass.glb
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/models/grass.glb.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="scene"
4 | importer_version=1
5 | type="PackedScene"
6 | uid="uid://blqf5cwsk25xj"
7 | path="res://.godot/imported/grass.glb-e9c470eff7d61ec19c9b1562deb7c5d3.scn"
8 |
9 | [deps]
10 |
11 | source_file="res://examples/kenney_platformer/models/grass.glb"
12 | dest_files=["res://.godot/imported/grass.glb-e9c470eff7d61ec19c9b1562deb7c5d3.scn"]
13 |
14 | [params]
15 |
16 | nodes/root_type="Node3D"
17 | nodes/root_name="Scene Root"
18 | nodes/apply_root_scale=true
19 | nodes/root_scale=1.0
20 | nodes/import_as_skeleton_bones=false
21 | meshes/ensure_tangents=true
22 | meshes/generate_lods=true
23 | meshes/create_shadow_meshes=true
24 | meshes/light_baking=1
25 | meshes/lightmap_texel_size=0.2
26 | meshes/force_disable_compression=false
27 | skins/use_named_skins=true
28 | animation/import=true
29 | animation/fps=30
30 | animation/trimming=false
31 | animation/remove_immutable_tracks=true
32 | animation/import_rest_as_RESET=false
33 | import_script/path=""
34 | _subresources={}
35 | gltf/naming_version=0
36 | gltf/embedded_image_handling=1
37 |
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/models/platform-falling.glb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/kenney_platformer/models/platform-falling.glb
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/models/platform-falling.glb.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="scene"
4 | importer_version=1
5 | type="PackedScene"
6 | uid="uid://biyd6x403gvny"
7 | path="res://.godot/imported/platform-falling.glb-3dfd703c9352594764bf5d2942e6c2a5.scn"
8 |
9 | [deps]
10 |
11 | source_file="res://examples/kenney_platformer/models/platform-falling.glb"
12 | dest_files=["res://.godot/imported/platform-falling.glb-3dfd703c9352594764bf5d2942e6c2a5.scn"]
13 |
14 | [params]
15 |
16 | nodes/root_type="Node3D"
17 | nodes/root_name="Scene Root"
18 | nodes/apply_root_scale=true
19 | nodes/root_scale=1.0
20 | nodes/import_as_skeleton_bones=false
21 | meshes/ensure_tangents=true
22 | meshes/generate_lods=true
23 | meshes/create_shadow_meshes=true
24 | meshes/light_baking=1
25 | meshes/lightmap_texel_size=0.2
26 | meshes/force_disable_compression=false
27 | skins/use_named_skins=true
28 | animation/import=true
29 | animation/fps=30
30 | animation/trimming=false
31 | animation/remove_immutable_tracks=true
32 | animation/import_rest_as_RESET=false
33 | import_script/path=""
34 | _subresources={}
35 | gltf/naming_version=0
36 | gltf/embedded_image_handling=1
37 |
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/models/platform-grass-large-round.glb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/kenney_platformer/models/platform-grass-large-round.glb
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/models/platform-grass-large-round.glb.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="scene"
4 | importer_version=1
5 | type="PackedScene"
6 | uid="uid://fqfc0dtl2xlc"
7 | path="res://.godot/imported/platform-grass-large-round.glb-c4017051eec1037cd54a8bf1a3a889d7.scn"
8 |
9 | [deps]
10 |
11 | source_file="res://examples/kenney_platformer/models/platform-grass-large-round.glb"
12 | dest_files=["res://.godot/imported/platform-grass-large-round.glb-c4017051eec1037cd54a8bf1a3a889d7.scn"]
13 |
14 | [params]
15 |
16 | nodes/root_type="Node3D"
17 | nodes/root_name="Scene Root"
18 | nodes/apply_root_scale=true
19 | nodes/root_scale=1.0
20 | nodes/import_as_skeleton_bones=false
21 | meshes/ensure_tangents=true
22 | meshes/generate_lods=true
23 | meshes/create_shadow_meshes=true
24 | meshes/light_baking=1
25 | meshes/lightmap_texel_size=0.2
26 | meshes/force_disable_compression=false
27 | skins/use_named_skins=true
28 | animation/import=true
29 | animation/fps=30
30 | animation/trimming=false
31 | animation/remove_immutable_tracks=true
32 | animation/import_rest_as_RESET=false
33 | import_script/path=""
34 | _subresources={}
35 | gltf/naming_version=0
36 | gltf/embedded_image_handling=1
37 |
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/models/platform-large.glb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/kenney_platformer/models/platform-large.glb
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/models/platform-large.glb.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="scene"
4 | importer_version=1
5 | type="PackedScene"
6 | uid="uid://bn0iedr5b0xbv"
7 | path="res://.godot/imported/platform-large.glb-3d11c1b945c39ee3e66e235e2c7e385e.scn"
8 |
9 | [deps]
10 |
11 | source_file="res://examples/kenney_platformer/models/platform-large.glb"
12 | dest_files=["res://.godot/imported/platform-large.glb-3d11c1b945c39ee3e66e235e2c7e385e.scn"]
13 |
14 | [params]
15 |
16 | nodes/root_type="Node3D"
17 | nodes/root_name="Scene Root"
18 | nodes/apply_root_scale=true
19 | nodes/root_scale=1.0
20 | nodes/import_as_skeleton_bones=false
21 | meshes/ensure_tangents=true
22 | meshes/generate_lods=true
23 | meshes/create_shadow_meshes=true
24 | meshes/light_baking=1
25 | meshes/lightmap_texel_size=0.2
26 | meshes/force_disable_compression=false
27 | skins/use_named_skins=true
28 | animation/import=true
29 | animation/fps=30
30 | animation/trimming=false
31 | animation/remove_immutable_tracks=true
32 | animation/import_rest_as_RESET=false
33 | import_script/path=""
34 | _subresources={}
35 | gltf/naming_version=0
36 | gltf/embedded_image_handling=1
37 |
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/models/platform-medium.glb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/kenney_platformer/models/platform-medium.glb
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/models/platform-medium.glb.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="scene"
4 | importer_version=1
5 | type="PackedScene"
6 | uid="uid://c5vgh1v6juur0"
7 | path="res://.godot/imported/platform-medium.glb-e925f842b980670e172b1c8ae888030e.scn"
8 |
9 | [deps]
10 |
11 | source_file="res://examples/kenney_platformer/models/platform-medium.glb"
12 | dest_files=["res://.godot/imported/platform-medium.glb-e925f842b980670e172b1c8ae888030e.scn"]
13 |
14 | [params]
15 |
16 | nodes/root_type="Node3D"
17 | nodes/root_name="Scene Root"
18 | nodes/apply_root_scale=true
19 | nodes/root_scale=1.0
20 | nodes/import_as_skeleton_bones=false
21 | meshes/ensure_tangents=true
22 | meshes/generate_lods=true
23 | meshes/create_shadow_meshes=true
24 | meshes/light_baking=1
25 | meshes/lightmap_texel_size=0.2
26 | meshes/force_disable_compression=false
27 | skins/use_named_skins=true
28 | animation/import=true
29 | animation/fps=30
30 | animation/trimming=false
31 | animation/remove_immutable_tracks=true
32 | animation/import_rest_as_RESET=false
33 | import_script/path=""
34 | _subresources={}
35 | gltf/naming_version=0
36 | gltf/embedded_image_handling=1
37 |
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/models/platform.glb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/kenney_platformer/models/platform.glb
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/models/platform.glb.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="scene"
4 | importer_version=1
5 | type="PackedScene"
6 | uid="uid://do8sg1k5xvj2h"
7 | path="res://.godot/imported/platform.glb-09902c90e45ca31d1de03e39e4d53191.scn"
8 |
9 | [deps]
10 |
11 | source_file="res://examples/kenney_platformer/models/platform.glb"
12 | dest_files=["res://.godot/imported/platform.glb-09902c90e45ca31d1de03e39e4d53191.scn"]
13 |
14 | [params]
15 |
16 | nodes/root_type="Node3D"
17 | nodes/root_name="Scene Root"
18 | nodes/apply_root_scale=true
19 | nodes/root_scale=1.0
20 | nodes/import_as_skeleton_bones=false
21 | meshes/ensure_tangents=true
22 | meshes/generate_lods=true
23 | meshes/create_shadow_meshes=true
24 | meshes/light_baking=1
25 | meshes/lightmap_texel_size=0.2
26 | meshes/force_disable_compression=false
27 | skins/use_named_skins=true
28 | animation/import=true
29 | animation/fps=30
30 | animation/trimming=false
31 | animation/remove_immutable_tracks=true
32 | animation/import_rest_as_RESET=false
33 | import_script/path=""
34 | _subresources={}
35 | gltf/naming_version=0
36 | gltf/embedded_image_handling=1
37 |
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/objects/character.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=2 format=3 uid="uid://c0e27836xgmhi"]
2 |
3 | [ext_resource type="PackedScene" uid="uid://xy8rvnjp22n5" path="res://examples/kenney_platformer/models/character.glb" id="1_vn7w5"]
4 |
5 | [node name="character" instance=ExtResource("1_vn7w5")]
6 |
7 | [node name="leg-left" parent="character/root" index="0"]
8 | transform = Transform3D(0.965926, 0, 0.258819, 0, 1, 0, -0.258819, 0, 0.965926, 0.125, 0.17625, -0.02375)
9 |
10 | [node name="leg-right" parent="character/root" index="1"]
11 | transform = Transform3D(0.965926, 0, -0.258819, 0, 1, 0, 0.258819, 0, 0.965926, -0.125, 0.17625, -0.02375)
12 |
13 | [node name="torso" parent="character/root" index="2"]
14 | transform = Transform3D(1, 0, 0, 0, 0.996194, 0.0871557, 0, -0.0871557, 0.996194, -1.80478e-15, 0.17625, -0.02375)
15 |
16 | [node name="arm-left" parent="character/root/torso" index="0"]
17 | transform = Transform3D(0.707107, 0.707107, 0, -0.707107, 0.707107, 0, 0, 0, 1, 0.3, 0.175, 0)
18 |
19 | [node name="arm-right" parent="character/root/torso" index="1"]
20 | transform = Transform3D(0.707107, -0.707107, 0, 0.707107, 0.707107, 0, 0, 0, 1, -0.3, 0.1195, 0)
21 |
22 | [node name="antenna" parent="character/root/torso" index="2"]
23 | transform = Transform3D(1, 0, 0, 0, 0.999999, 0, 0, 0, 0.999999, 0, 0.6, 0)
24 |
25 | [node name="AnimationPlayer" parent="." index="1"]
26 | deterministic = true
27 | playback_default_blend_time = 0.2
28 |
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/objects/cloud.gd:
--------------------------------------------------------------------------------
1 | extends Node3D
2 |
3 | var time = 0.0
4 |
5 | var random_number = RandomNumberGenerator.new()
6 |
7 | var random_velocity:float
8 | var random_time:float
9 |
10 | func _ready():
11 |
12 | random_velocity = random_number.randf_range(0.1, 2.0)
13 | random_time = random_number.randf_range(0.1, 2.0)
14 |
15 | func _process(delta):
16 |
17 | position.y += (cos(time * random_time) * random_velocity) * delta # Sine movement
18 |
19 | time += delta
20 |
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/objects/cloud.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=3 format=3 uid="uid://dy017k58p20sk"]
2 |
3 | [ext_resource type="PackedScene" uid="uid://bsrmqj84lksd7" path="res://examples/kenney_platformer/models/cloud.glb" id="1_pjiy0"]
4 | [ext_resource type="Script" path="res://examples/kenney_platformer/objects/cloud.gd" id="2_hugjq"]
5 |
6 | [node name="cube" instance=ExtResource("1_pjiy0")]
7 | script = ExtResource("2_hugjq")
8 |
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/objects/coin.gd:
--------------------------------------------------------------------------------
1 | extends Area3D
2 |
3 | var time := 0.0
4 | var grabbed := false
5 |
6 | # Collecting coins
7 |
8 | func _on_body_entered(body):
9 | if body.has_method("collect_coin") and !grabbed:
10 |
11 | body.collect_coin()
12 |
13 | Audio.play("res://examples/kenney_platformer/sounds/coin.ogg") # Play sound
14 |
15 | $Mesh.queue_free() # Make invisible
16 | $Particles.emitting = false # Stop emitting stars
17 |
18 | grabbed = true
19 |
20 | # Rotating, animating up and down
21 |
22 | func _process(delta):
23 |
24 | rotate_y(2 * delta) # Rotation
25 | position.y += (cos(time * 5) * 1) * delta # Sine movement
26 |
27 | time += delta
28 |
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/objects/platform_falling.gd:
--------------------------------------------------------------------------------
1 | extends Node3D
2 |
3 | var falling := false
4 | var gravity := 0.0
5 |
6 | func _process(delta):
7 | scale = scale.lerp(Vector3(1, 1, 1), delta * 10) # Animate scale
8 |
9 | position.y -= gravity * delta
10 |
11 | if position.y < -10:
12 | queue_free() # Remove platform if below threshold
13 |
14 | if falling:
15 | gravity += 0.25
16 |
17 |
18 | func _on_body_entered(_body):
19 | if !falling:
20 | Audio.play("res://examples/kenney_platformer/sounds/fall.ogg") # Play sound
21 | scale = Vector3(1.25, 1, 1.25) # Animate scale
22 |
23 | falling = true
24 |
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/objects/player.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=11 format=3 uid="uid://dl2ed4gkybggf"]
2 |
3 | [ext_resource type="Script" path="res://examples/kenney_platformer/scripts/player.gd" id="1_ffboj"]
4 | [ext_resource type="PackedScene" uid="uid://c0e27836xgmhi" path="res://examples/kenney_platformer/objects/character.tscn" id="2_nero3"]
5 | [ext_resource type="Texture2D" uid="uid://8ggihh27mlrr" path="res://examples/kenney_platformer/sprites/blob_shadow.png" id="3_0c7wt"]
6 | [ext_resource type="PackedScene" uid="uid://kwottvmkrb6w" path="res://examples/hello/models/godot_logo/scene.gltf" id="3_vhu60"]
7 | [ext_resource type="ArrayMesh" uid="uid://deu06eho4c74" path="res://examples/kenney_platformer/meshes/dust.res" id="4_mvhqy"]
8 | [ext_resource type="Script" path="res://examples/hello/models/godot_logo/blinking.gd" id="4_n8oi4"]
9 | [ext_resource type="AudioStream" uid="uid://cydjn1ct3hps2" path="res://examples/kenney_platformer/sounds/walking.ogg" id="5_ics1s"]
10 |
11 | [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_gdq8c"]
12 | radius = 0.3
13 | height = 1.0
14 |
15 | [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_q7stj"]
16 | diffuse_mode = 2
17 | specular_mode = 2
18 | metallic_specular = 0.0
19 | backlight = Color(0, 0.521569, 0.709804, 1)
20 | billboard_keep_scale = true
21 | grow_amount = 1.882
22 | proximity_fade_distance = 0.25
23 |
24 | [sub_resource type="Curve" id="Curve_xh1e2"]
25 | _data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.249284, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
26 | point_count = 3
27 |
28 | [node name="Player" type="CharacterBody3D"]
29 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0)
30 | script = ExtResource("1_ffboj")
31 |
32 | [node name="Collider" type="CollisionShape3D" parent="."]
33 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.55, 0)
34 | shape = SubResource("CapsuleShape3D_gdq8c")
35 |
36 | [node name="Character" parent="." instance=ExtResource("2_nero3")]
37 |
38 | [node name="root" parent="Character/character" index="0"]
39 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.039768, 9.02389e-17)
40 |
41 | [node name="leg-left" parent="Character/character/root" index="0"]
42 | transform = Transform3D(1, 0, 0, 0, 0.998477, -0.0551715, 0, 0.0551715, 0.998477, 0.125, 0.183805, -0.0447526)
43 |
44 | [node name="leg-right" parent="Character/character/root" index="1"]
45 | transform = Transform3D(1, 0, 0, 0, 0.998477, 0.0551715, 0, -0.0551715, 0.998477, -0.125, 0.178716, -0.00518778)
46 |
47 | [node name="torso" parent="Character/character/root" index="2"]
48 | transform = Transform3D(0.99988, 0.000675873, 0.0154848, -0.000535728, 0.999958, -0.00905285, -0.0154903, 0.00904347, 0.999838, -1.80478e-15, 0.17625, -0.02375)
49 |
50 | [node name="arm-left" parent="Character/character/root/torso" index="0"]
51 | transform = Transform3D(0.732734, 0.680509, -0.00293125, -0.680509, 0.732739, 0.00124445, 0.0029947, 0.0010829, 0.999995, 0.3, 0.175, 0)
52 |
53 | [node name="arm-right" parent="Character/character/root/torso" index="1"]
54 | transform = Transform3D(0.732734, -0.680509, 0.00293125, 0.680509, 0.732739, 0.00124445, -0.0029947, 0.0010829, 0.999995, -0.3, 0.1195, 0)
55 |
56 | [node name="antenna" parent="Character/character/root/torso" index="2"]
57 | transform = Transform3D(1, 0, 0, 0, 0.999588, 0.0286574, 0, -0.0286574, 0.999588, 0, 0.6, 0)
58 |
59 | [node name="Godot_Head" parent="Character/character/root/torso" index="3" instance=ExtResource("3_vhu60")]
60 | transform = Transform3D(0.229981, 8.52303e-05, -0.00295384, 5.66202e-05, 0.229735, 0.0110371, 0.00295453, -0.011037, 0.229716, -0.00472002, 0.303365, 0.360322)
61 | script = ExtResource("4_n8oi4")
62 |
63 | [node name="Shadow" type="Decal" parent="."]
64 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.9, 0)
65 | size = Vector3(1, 2, 1)
66 | texture_albedo = ExtResource("3_0c7wt")
67 | modulate = Color(1, 1, 1, 0.705882)
68 | normal_fade = 0.5
69 |
70 | [node name="ParticlesTrail" type="CPUParticles3D" parent="."]
71 | material_override = SubResource("StandardMaterial3D_q7stj")
72 | cast_shadow = 0
73 | amount = 60
74 | mesh = ExtResource("4_mvhqy")
75 | emission_shape = 1
76 | emission_sphere_radius = 0.2
77 | particle_flag_align_y = true
78 | direction = Vector3(0, 0, 0)
79 | gravity = Vector3(0, 0.1, 0)
80 | scale_amount_min = 0.75
81 | scale_amount_curve = SubResource("Curve_xh1e2")
82 |
83 | [node name="SoundFootsteps" type="AudioStreamPlayer" parent="."]
84 | stream = ExtResource("5_ics1s")
85 | volume_db = -5.0
86 | pitch_scale = 1.25
87 | autoplay = true
88 |
89 | [editable path="Character"]
90 |
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/scripts/audio.gd:
--------------------------------------------------------------------------------
1 | extends Node
2 |
3 | # Code adapted from KidsCanCode
4 |
5 | var num_players = 12
6 | var bus = "master"
7 |
8 | var available = [] # The available players.
9 | var queue = [] # The queue of sounds to play.
10 |
11 | func _ready():
12 |
13 | for i in num_players:
14 | var p = AudioStreamPlayer.new()
15 | add_child(p)
16 |
17 | available.append(p)
18 |
19 | p.volume_db = -10
20 | p.finished.connect(_on_stream_finished.bind(p))
21 | p.bus = bus
22 |
23 |
24 | func _on_stream_finished(stream): available.append(stream)
25 |
26 | func play(sound_path): queue.append(sound_path)
27 |
28 | func _process(_delta):
29 |
30 | if not queue.is_empty() and not available.is_empty():
31 |
32 | available[0].stream = load(queue.pop_front())
33 | available[0].play()
34 | available[0].pitch_scale = randf_range(0.9, 1.1)
35 |
36 | available.pop_front()
37 |
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/scripts/hud.gd:
--------------------------------------------------------------------------------
1 | extends CanvasLayer
2 |
3 | func _on_coin_collected(coins):
4 |
5 | $Coins.text = str(coins)
6 |
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/scripts/player.gd:
--------------------------------------------------------------------------------
1 | extends CharacterBody3D
2 |
3 | signal coin_collected
4 |
5 | @export_subgroup("Components")
6 | @export var view: Node3D
7 |
8 | @export_subgroup("Properties")
9 | @export var movement_speed = 250
10 | @export var jump_strength = 7
11 |
12 | var movement_velocity: Vector3
13 | var rotation_direction: float
14 | var gravity = 0
15 |
16 | var previously_floored = false
17 |
18 | var jump_single = true
19 | var jump_double = true
20 |
21 | var coins = 0
22 |
23 | @onready var particles_trail = $ParticlesTrail
24 | @onready var sound_footsteps = $SoundFootsteps
25 | @onready var model = $Character
26 | @onready var animation = $Character/AnimationPlayer
27 |
28 | # Functions
29 |
30 | func respawn():
31 | get_tree().reload_current_scene()
32 |
33 | func _physics_process(delta):
34 |
35 | # Handle functions
36 |
37 | handle_controls(delta)
38 | handle_gravity(delta)
39 |
40 | handle_effects(delta)
41 |
42 | # Movement
43 |
44 | var applied_velocity: Vector3
45 |
46 | applied_velocity = velocity.lerp(movement_velocity, delta * 10)
47 | applied_velocity.y = -gravity
48 |
49 | velocity = applied_velocity
50 | move_and_slide()
51 |
52 | # Rotation
53 |
54 | if Vector2(velocity.z, velocity.x).length() > 0:
55 | rotation_direction = Vector2(velocity.z, velocity.x).angle()
56 |
57 | rotation.y = lerp_angle(rotation.y, rotation_direction, delta * 10)
58 |
59 | # Falling/respawning
60 |
61 | if position.y < -10:
62 | respawn()
63 |
64 | # Animation for scale (jumping and landing)
65 |
66 | model.scale = model.scale.lerp(Vector3(1, 1, 1), delta * 10)
67 |
68 | # Animation when landing
69 |
70 | if is_on_floor() and gravity > 2 and !previously_floored:
71 | model.scale = Vector3(1.25, 0.75, 1.25)
72 | Audio.play("res://examples/kenney_platformer/sounds/land.ogg")
73 |
74 | previously_floored = is_on_floor()
75 |
76 | # Handle animation(s)
77 |
78 | func handle_effects(delta):
79 |
80 | particles_trail.emitting = false
81 | sound_footsteps.stream_paused = true
82 |
83 | if is_on_floor():
84 | var horizontal_velocity = Vector2(velocity.x, velocity.z)
85 | var speed_factor = horizontal_velocity.length() / movement_speed / delta
86 | if speed_factor > 0.05:
87 | if animation.current_animation != "walk":
88 | animation.play("walk", 0.1)
89 |
90 | if speed_factor > 0.3:
91 | sound_footsteps.stream_paused = false
92 | sound_footsteps.pitch_scale = speed_factor
93 |
94 | if speed_factor > 0.75:
95 | particles_trail.emitting = true
96 |
97 | elif animation.current_animation != "idle":
98 | animation.play("idle", 0.1)
99 | elif animation.current_animation != "jump":
100 | animation.play("jump", 0.1)
101 |
102 | # Handle movement input
103 |
104 | func handle_controls(delta):
105 |
106 | # Movement
107 |
108 | var input := Vector3.ZERO
109 |
110 | input.x = Input.get_axis("move_left", "move_right")
111 | input.z = Input.get_axis("move_forward", "move_back")
112 |
113 | if view:
114 | input = input.rotated(Vector3.UP, view.rotation.y)
115 |
116 | if input.length() > 1:
117 | input = input.normalized()
118 |
119 | movement_velocity = input * movement_speed * delta
120 |
121 | # Jumping
122 |
123 | if Input.is_action_just_pressed("jump"):
124 |
125 | if jump_single or jump_double:
126 | jump()
127 |
128 | # Handle gravity
129 |
130 | func handle_gravity(delta):
131 |
132 | gravity += 25 * delta
133 |
134 | if gravity > 0 and is_on_floor():
135 |
136 | jump_single = true
137 | gravity = 0
138 |
139 | # Jumping
140 |
141 | func jump():
142 |
143 | Audio.play("res://examples/kenney_platformer/sounds/jump.ogg")
144 |
145 | gravity = -jump_strength
146 |
147 | model.scale = Vector3(0.5, 1.5, 0.5)
148 |
149 | if jump_single:
150 | jump_single = false;
151 | jump_double = true;
152 | else:
153 | jump_double = false;
154 |
155 | # Collecting coins
156 |
157 | func collect_coin():
158 |
159 | coins += 1
160 |
161 | coin_collected.emit(coins)
162 |
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/scripts/view.gd:
--------------------------------------------------------------------------------
1 | extends Node3D
2 |
3 | @export_group("Properties")
4 | @export var target: Node
5 |
6 | @export_group("Zoom")
7 | @export var zoom_minimum = 16
8 | @export var zoom_maximum = 4
9 | @export var zoom_speed = 10
10 |
11 | @export_group("Rotation")
12 | @export var rotation_speed = 120
13 |
14 | var camera_rotation:Vector3
15 | var zoom = 10
16 |
17 | @onready var camera = $Camera
18 |
19 | func _ready():
20 |
21 | camera_rotation = rotation_degrees # Initial rotation
22 |
23 | pass
24 |
25 | func _physics_process(delta):
26 |
27 | # Set position and rotation to targets
28 |
29 | self.position = self.position.lerp(target.position, delta * 4)
30 | rotation_degrees = rotation_degrees.lerp(camera_rotation, delta * 6)
31 |
32 | camera.position = camera.position.lerp(Vector3(0, 0, zoom), 8 * delta)
33 |
34 | handle_input(delta)
35 |
36 | # Handle input
37 |
38 | func handle_input(delta):
39 |
40 | # Rotation
41 |
42 | var input := Vector3.ZERO
43 |
44 | input.y = Input.get_axis("camera_left", "camera_right")
45 | input.x = Input.get_axis("camera_up", "camera_down")
46 |
47 | camera_rotation += input.limit_length(1.0) * rotation_speed * delta
48 | camera_rotation.x = clamp(camera_rotation.x, -80, -10)
49 |
50 | # Zooming
51 |
52 | zoom += Input.get_axis("zoom_in", "zoom_out") * zoom_speed * delta
53 | zoom = clamp(zoom, zoom_maximum, zoom_minimum)
54 |
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/sounds/coin.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/kenney_platformer/sounds/coin.ogg
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/sounds/coin.ogg.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="oggvorbisstr"
4 | type="AudioStreamOggVorbis"
5 | uid="uid://bygrj12u37fyu"
6 | path="res://.godot/imported/coin.ogg-3664aca43b1e5e7855e25c426dae4782.oggvorbisstr"
7 |
8 | [deps]
9 |
10 | source_file="res://examples/kenney_platformer/sounds/coin.ogg"
11 | dest_files=["res://.godot/imported/coin.ogg-3664aca43b1e5e7855e25c426dae4782.oggvorbisstr"]
12 |
13 | [params]
14 |
15 | loop=false
16 | loop_offset=0
17 | bpm=0
18 | beat_count=0
19 | bar_beats=4
20 |
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/sounds/fall.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/kenney_platformer/sounds/fall.ogg
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/sounds/fall.ogg.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="oggvorbisstr"
4 | type="AudioStreamOggVorbis"
5 | uid="uid://cko3em7xury11"
6 | path="res://.godot/imported/fall.ogg-28b193ad9c9595ce02a8a9cf76da9c4b.oggvorbisstr"
7 |
8 | [deps]
9 |
10 | source_file="res://examples/kenney_platformer/sounds/fall.ogg"
11 | dest_files=["res://.godot/imported/fall.ogg-28b193ad9c9595ce02a8a9cf76da9c4b.oggvorbisstr"]
12 |
13 | [params]
14 |
15 | loop=false
16 | loop_offset=0
17 | bpm=0
18 | beat_count=0
19 | bar_beats=4
20 |
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/sounds/jump.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/kenney_platformer/sounds/jump.ogg
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/sounds/jump.ogg.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="oggvorbisstr"
4 | type="AudioStreamOggVorbis"
5 | uid="uid://dw2m5fxhfjykq"
6 | path="res://.godot/imported/jump.ogg-2f54d5fd854ad7668c313c9f01c5596d.oggvorbisstr"
7 |
8 | [deps]
9 |
10 | source_file="res://examples/kenney_platformer/sounds/jump.ogg"
11 | dest_files=["res://.godot/imported/jump.ogg-2f54d5fd854ad7668c313c9f01c5596d.oggvorbisstr"]
12 |
13 | [params]
14 |
15 | loop=false
16 | loop_offset=0
17 | bpm=0
18 | beat_count=0
19 | bar_beats=4
20 |
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/sounds/land.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/kenney_platformer/sounds/land.ogg
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/sounds/land.ogg.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="oggvorbisstr"
4 | type="AudioStreamOggVorbis"
5 | uid="uid://xnxidwkp46un"
6 | path="res://.godot/imported/land.ogg-62485ae29c86b188e5ddd53ee78253f3.oggvorbisstr"
7 |
8 | [deps]
9 |
10 | source_file="res://examples/kenney_platformer/sounds/land.ogg"
11 | dest_files=["res://.godot/imported/land.ogg-62485ae29c86b188e5ddd53ee78253f3.oggvorbisstr"]
12 |
13 | [params]
14 |
15 | loop=false
16 | loop_offset=0
17 | bpm=0
18 | beat_count=0
19 | bar_beats=4
20 |
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/sounds/walking.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/kenney_platformer/sounds/walking.ogg
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/sounds/walking.ogg.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="oggvorbisstr"
4 | type="AudioStreamOggVorbis"
5 | uid="uid://cydjn1ct3hps2"
6 | path="res://.godot/imported/walking.ogg-747fb3627f0bb4860332a3738ca37551.oggvorbisstr"
7 |
8 | [deps]
9 |
10 | source_file="res://examples/kenney_platformer/sounds/walking.ogg"
11 | dest_files=["res://.godot/imported/walking.ogg-747fb3627f0bb4860332a3738ca37551.oggvorbisstr"]
12 |
13 | [params]
14 |
15 | loop=true
16 | loop_offset=0.0
17 | bpm=0.0
18 | beat_count=0
19 | bar_beats=4
20 |
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/sounds/walking.ogg.sfk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/kenney_platformer/sounds/walking.ogg.sfk
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/sprites/blob_shadow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/kenney_platformer/sprites/blob_shadow.png
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/sprites/blob_shadow.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://8ggihh27mlrr"
6 | path="res://.godot/imported/blob_shadow.png-c1c33e5293eeb64190900c913cfe9e1f.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://examples/kenney_platformer/sprites/blob_shadow.png"
14 | dest_files=["res://.godot/imported/blob_shadow.png-c1c33e5293eeb64190900c913cfe9e1f.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/hdr_compression=1
22 | compress/normal_map=0
23 | compress/channel_pack=0
24 | mipmaps/generate=false
25 | mipmaps/limit=-1
26 | roughness/mode=0
27 | roughness/src_normal=""
28 | process/fix_alpha_border=true
29 | process/premult_alpha=false
30 | process/normal_map_invert_y=false
31 | process/hdr_as_srgb=false
32 | process/hdr_clamp_exposure=false
33 | process/size_limit=0
34 | detect_3d/compress_to=1
35 |
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/sprites/coin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/kenney_platformer/sprites/coin.png
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/sprites/coin.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://cd7oyc56ehkx1"
6 | path.s3tc="res://.godot/imported/coin.png-aad772a263d8befe61a01f933c4d8386.s3tc.ctex"
7 | path.etc2="res://.godot/imported/coin.png-aad772a263d8befe61a01f933c4d8386.etc2.ctex"
8 | metadata={
9 | "imported_formats": ["s3tc_bptc", "etc2_astc"],
10 | "vram_texture": true
11 | }
12 |
13 | [deps]
14 |
15 | source_file="res://examples/kenney_platformer/sprites/coin.png"
16 | dest_files=["res://.godot/imported/coin.png-aad772a263d8befe61a01f933c4d8386.s3tc.ctex", "res://.godot/imported/coin.png-aad772a263d8befe61a01f933c4d8386.etc2.ctex"]
17 |
18 | [params]
19 |
20 | compress/mode=2
21 | compress/high_quality=false
22 | compress/lossy_quality=0.7
23 | compress/hdr_compression=1
24 | compress/normal_map=0
25 | compress/channel_pack=0
26 | mipmaps/generate=true
27 | mipmaps/limit=-1
28 | roughness/mode=0
29 | roughness/src_normal=""
30 | process/fix_alpha_border=true
31 | process/premult_alpha=false
32 | process/normal_map_invert_y=false
33 | process/hdr_as_srgb=false
34 | process/hdr_clamp_exposure=false
35 | process/size_limit=0
36 | detect_3d/compress_to=0
37 |
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/sprites/particle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/kenney_platformer/sprites/particle.png
--------------------------------------------------------------------------------
/Godot_Project/examples/kenney_platformer/sprites/particle.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://bs6puxrivhkk2"
6 | path.s3tc="res://.godot/imported/particle.png-cc017453c15ff9f22aa8793502666478.s3tc.ctex"
7 | path.etc2="res://.godot/imported/particle.png-cc017453c15ff9f22aa8793502666478.etc2.ctex"
8 | metadata={
9 | "imported_formats": ["s3tc_bptc", "etc2_astc"],
10 | "vram_texture": true
11 | }
12 |
13 | [deps]
14 |
15 | source_file="res://examples/kenney_platformer/sprites/particle.png"
16 | dest_files=["res://.godot/imported/particle.png-cc017453c15ff9f22aa8793502666478.s3tc.ctex", "res://.godot/imported/particle.png-cc017453c15ff9f22aa8793502666478.etc2.ctex"]
17 |
18 | [params]
19 |
20 | compress/mode=2
21 | compress/high_quality=false
22 | compress/lossy_quality=0.7
23 | compress/hdr_compression=1
24 | compress/normal_map=0
25 | compress/channel_pack=0
26 | mipmaps/generate=true
27 | mipmaps/limit=-1
28 | roughness/mode=0
29 | roughness/src_normal=""
30 | process/fix_alpha_border=true
31 | process/premult_alpha=false
32 | process/normal_map_invert_y=false
33 | process/hdr_as_srgb=false
34 | process/hdr_clamp_exposure=false
35 | process/size_limit=0
36 | detect_3d/compress_to=0
37 |
--------------------------------------------------------------------------------
/Godot_Project/examples/physics_toy/models/spring_rigged/license.txt:
--------------------------------------------------------------------------------
1 | Model Information:
2 | * title: Spring (Rigged)
3 | * source: https://sketchfab.com/3d-models/spring-rigged-939e76216d604b84ba8e6f97825795cb
4 | * author: unrealengine432 (https://sketchfab.com/unrealengine432)
5 |
6 | Model License:
7 | * license type: SKETCHFAB Standard (https://sketchfab.com/licenses)
8 | * requirements: Under basic restrictions, use worldwide, on all types of media, commercially or not, and in all types of derivative works
9 |
--------------------------------------------------------------------------------
/Godot_Project/examples/physics_toy/models/spring_rigged/scene.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/physics_toy/models/spring_rigged/scene.bin
--------------------------------------------------------------------------------
/Godot_Project/examples/physics_toy/models/spring_rigged/scene.gltf.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="scene"
4 | importer_version=1
5 | type="PackedScene"
6 | uid="uid://bk2vmbinktj6m"
7 | path="res://.godot/imported/scene.gltf-b1f9dbd2d7ee7dc3f3fa1ed260add892.scn"
8 |
9 | [deps]
10 |
11 | source_file="res://examples/physics_toy/models/spring_rigged/scene.gltf"
12 | dest_files=["res://.godot/imported/scene.gltf-b1f9dbd2d7ee7dc3f3fa1ed260add892.scn"]
13 |
14 | [params]
15 |
16 | nodes/root_type=""
17 | nodes/root_name=""
18 | nodes/apply_root_scale=true
19 | nodes/root_scale=1.0
20 | nodes/import_as_skeleton_bones=false
21 | meshes/ensure_tangents=true
22 | meshes/generate_lods=true
23 | meshes/create_shadow_meshes=true
24 | meshes/light_baking=1
25 | meshes/lightmap_texel_size=0.2
26 | meshes/force_disable_compression=false
27 | skins/use_named_skins=true
28 | animation/import=true
29 | animation/fps=30
30 | animation/trimming=false
31 | animation/remove_immutable_tracks=true
32 | animation/import_rest_as_RESET=false
33 | import_script/path=""
34 | _subresources={}
35 | gltf/naming_version=1
36 | gltf/embedded_image_handling=1
37 |
--------------------------------------------------------------------------------
/Godot_Project/examples/physics_toy/physics_toy.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=11 format=3 uid="uid://7sh7v8nu44lc"]
2 |
3 | [ext_resource type="PackedScene" uid="uid://biunegs8tkvn0" path="res://addons/godot_vision/VisionVolumeCamera.tscn" id="1_lv7bk"]
4 | [ext_resource type="PackedScene" uid="uid://43rktd62aem5" path="res://examples/physics_toy/prefabs/emitter.tscn" id="2_8ripl"]
5 | [ext_resource type="PackedScene" uid="uid://bxbkpri64rh7f" path="res://examples/physics_toy/prefabs/diagonal_toggle_board.tscn" id="3_c6xjb"]
6 | [ext_resource type="PackedScene" uid="uid://h2hleasl7813" path="res://examples/physics_toy/prefabs/spring.tscn" id="4_ywf1x"]
7 | [ext_resource type="PackedScene" uid="uid://cthxmr6qmrukk" path="res://examples/physics_toy/prefabs/water_wheel.tscn" id="5_m8oh6"]
8 |
9 | [sub_resource type="BoxShape3D" id="BoxShape3D_jqju8"]
10 | size = Vector3(2, 1.3, 1)
11 |
12 | [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_sjt1l"]
13 | transparency = 1
14 | albedo_color = Color(0, 0, 1, 0.478431)
15 |
16 | [sub_resource type="BoxMesh" id="BoxMesh_4iivh"]
17 | material = SubResource("StandardMaterial3D_sjt1l")
18 | size = Vector3(2, 1.3, 1)
19 |
20 | [sub_resource type="BoxShape3D" id="BoxShape3D_mc81m"]
21 | size = Vector3(1.5, 0.3, 1)
22 |
23 | [sub_resource type="BoxMesh" id="BoxMesh_7x7ch"]
24 | size = Vector3(1.5, 0.3, 1)
25 |
26 | [node name="PhysicsToy" type="Node3D"]
27 |
28 | [node name="VisionVolumeCamera" parent="." instance=ExtResource("1_lv7bk")]
29 |
30 | [node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
31 | transform = Transform3D(0.995205, 0.0901146, 0.0380385, -0.0403967, 0.0244906, 0.998884, 0.0890824, -0.99563, 0.0280134, 0, 0, 0)
32 | shadow_enabled = true
33 |
34 | [node name="toy" type="Node3D" parent="."]
35 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.53417, 0, 0)
36 |
37 | [node name="Emitter" parent="toy" instance=ExtResource("2_8ripl")]
38 | transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, -0.00344056, 1.70462, 0.00101805)
39 |
40 | [node name="Emitter2" parent="toy" instance=ExtResource("2_8ripl")]
41 | transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, -5.03546, 2.62865, 0.00101805)
42 |
43 | [node name="DiagonalToggleBoard" parent="toy" instance=ExtResource("3_c6xjb")]
44 |
45 | [node name="DiagonalToggleBoard2" parent="toy" instance=ExtResource("3_c6xjb")]
46 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, -1, 2.08165e-12)
47 |
48 | [node name="DiagonalToggleBoard3" parent="toy" instance=ExtResource("3_c6xjb")]
49 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, -1, 2.08165e-12)
50 |
51 | [node name="Spring" parent="toy" instance=ExtResource("4_ywf1x")]
52 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.20892, -2.47231, 5.20412e-12)
53 |
54 | [node name="Spring2" parent="toy" instance=ExtResource("4_ywf1x")]
55 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00444627, -2.47231, 5.20412e-12)
56 |
57 | [node name="ZeroGravZone" type="Node3D" parent="toy"]
58 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.50665, -0.779248, 0)
59 |
60 | [node name="Area3D" type="Area3D" parent="toy/ZeroGravZone"]
61 | gravity_space_override = 3
62 | gravity = 6.66134e-16
63 |
64 | [node name="CollisionShape3D" type="CollisionShape3D" parent="toy/ZeroGravZone/Area3D"]
65 | shape = SubResource("BoxShape3D_jqju8")
66 |
67 | [node name="MeshInstance3D" type="MeshInstance3D" parent="toy/ZeroGravZone/Area3D"]
68 | mesh = SubResource("BoxMesh_4iivh")
69 |
70 | [node name="ZeroGravZone2" type="Node3D" parent="toy"]
71 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7.12493, 0.362967, -0.0786657)
72 |
73 | [node name="Area3D" type="Area3D" parent="toy/ZeroGravZone2"]
74 | gravity_space_override = 3
75 | gravity = 6.66134e-16
76 |
77 | [node name="CollisionShape3D" type="CollisionShape3D" parent="toy/ZeroGravZone2/Area3D"]
78 | shape = SubResource("BoxShape3D_jqju8")
79 |
80 | [node name="MeshInstance3D" type="MeshInstance3D" parent="toy/ZeroGravZone2/Area3D"]
81 | mesh = SubResource("BoxMesh_4iivh")
82 |
83 | [node name="Platform2" type="StaticBody3D" parent="toy"]
84 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -8.45672, -0.133251, 0)
85 |
86 | [node name="CollisionShape3D" type="CollisionShape3D" parent="toy/Platform2"]
87 | shape = SubResource("BoxShape3D_mc81m")
88 |
89 | [node name="MeshInstance3D" type="MeshInstance3D" parent="toy/Platform2"]
90 | mesh = SubResource("BoxMesh_7x7ch")
91 |
92 | [node name="MeshInstance3D2" type="MeshInstance3D" parent="toy/Platform2"]
93 | mesh = SubResource("BoxMesh_7x7ch")
94 |
95 | [node name="Platform" type="StaticBody3D" parent="toy"]
96 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.88214, 0, 0)
97 |
98 | [node name="CollisionShape3D" type="CollisionShape3D" parent="toy/Platform"]
99 | shape = SubResource("BoxShape3D_mc81m")
100 |
101 | [node name="MeshInstance3D" type="MeshInstance3D" parent="toy/Platform"]
102 | mesh = SubResource("BoxMesh_7x7ch")
103 |
104 | [node name="MeshInstance3D2" type="MeshInstance3D" parent="toy/Platform"]
105 | mesh = SubResource("BoxMesh_7x7ch")
106 |
107 | [node name="WaterWheel" parent="toy" instance=ExtResource("5_m8oh6")]
108 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -10.5208, -0.400309, 2.08165e-12)
109 |
110 | [node name="WaterWheel2" parent="toy" instance=ExtResource("5_m8oh6")]
111 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.52874, -1.97906, 2.08165e-12)
112 |
--------------------------------------------------------------------------------
/Godot_Project/examples/physics_toy/prefabs/ball.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=9 format=3 uid="uid://ca4r4hmmhcldf"]
2 |
3 | [ext_resource type="Script" path="res://examples/physics_toy/scripts/ball.gd" id="1_f31ku"]
4 | [ext_resource type="Script" path="res://examples/physics_toy/scripts/out_of_bounds.gd" id="2_t8akg"]
5 | [ext_resource type="Script" path="res://examples/physics_toy/scripts/PhysicsCollisionSound.gd" id="3_u2rwa"]
6 | [ext_resource type="AudioStream" uid="uid://d06yj67igh28l" path="res://examples/physics_toy/sounds/332661__reitanna__big-thud.mp3" id="4_amyrq"]
7 | [ext_resource type="AudioStream" uid="uid://dygabhvbnucxw" path="res://examples/physics_toy/sounds/683101__florianreichelt__quick-woosh.mp3" id="6_btgwo"]
8 |
9 | [sub_resource type="SphereMesh" id="SphereMesh_h7yn1"]
10 | radius = 0.2
11 | height = 0.4
12 |
13 | [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_dbtxi"]
14 | albedo_color = Color(1, 0.207843, 1, 1)
15 |
16 | [sub_resource type="SphereShape3D" id="SphereShape3D_lxegb"]
17 | radius = 0.2
18 |
19 | [node name="BallRigidBody3D" type="RigidBody3D" node_paths=PackedStringArray("whoosh_sound")]
20 | max_contacts_reported = 10
21 | contact_monitor = true
22 | script = ExtResource("1_f31ku")
23 | whoosh_sound = NodePath("whoosh sound")
24 |
25 | [node name="MeshInstance3D" type="MeshInstance3D" parent="."]
26 | mesh = SubResource("SphereMesh_h7yn1")
27 | skeleton = NodePath("../..")
28 | surface_material_override/0 = SubResource("StandardMaterial3D_dbtxi")
29 |
30 | [node name="CollisionShape3D" type="CollisionShape3D" parent="."]
31 | shape = SubResource("SphereShape3D_lxegb")
32 |
33 | [node name="OutOfBoundsChecker" type="Node" parent="."]
34 | script = ExtResource("2_t8akg")
35 |
36 | [node name="PhysicsCollisionSound" type="Node" parent="."]
37 | script = ExtResource("3_u2rwa")
38 |
39 | [node name="sound" type="AudioStreamPlayer3D" parent="PhysicsCollisionSound"]
40 | stream = ExtResource("4_amyrq")
41 | volume_db = -11.1
42 |
43 | [node name="whoosh sound" type="AudioStreamPlayer3D" parent="."]
44 | stream = ExtResource("6_btgwo")
45 |
46 | [connection signal="body_entered" from="." to="PhysicsCollisionSound" method="_on_ball_rigid_body_3d_body_entered"]
47 | [connection signal="did_acccel" from="." to="whoosh sound" method="play_rk"]
48 | [connection signal="input_event" from="." to="." method="_on_input_event"]
49 |
--------------------------------------------------------------------------------
/Godot_Project/examples/physics_toy/prefabs/diagonal_toggle_board.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=9 format=3 uid="uid://bxbkpri64rh7f"]
2 |
3 | [ext_resource type="Script" path="res://examples/physics_toy/scripts/diagonal_toggle_board.gd" id="1_jq6sw"]
4 | [ext_resource type="AudioStream" uid="uid://cyi7jwxbakwsc" path="res://examples/physics_toy/sounds/71774__lg__switch-22.mp3" id="2_gq8rv"]
5 |
6 | [sub_resource type="BoxMesh" id="BoxMesh_i4leg"]
7 | size = Vector3(1, 0.03, 1)
8 |
9 | [sub_resource type="BoxShape3D" id="BoxShape3D_go6lu"]
10 | size = Vector3(1, 0.04, 1)
11 |
12 | [sub_resource type="CapsuleMesh" id="CapsuleMesh_g86my"]
13 | radius = 0.02
14 | height = 1.1
15 | radial_segments = 16
16 |
17 | [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_csd04"]
18 | albedo_color = Color(1, 0.0784314, 0, 1)
19 |
20 | [sub_resource type="CylinderMesh" id="CylinderMesh_bpiv6"]
21 | top_radius = 0.04
22 | bottom_radius = 0.06
23 | height = 0.05
24 |
25 | [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_lioj3"]
26 | albedo_color = Color(0.470588, 0.192157, 0.560784, 1)
27 |
28 | [node name="DiagonalToggleBoard" type="Node3D"]
29 | script = ExtResource("1_jq6sw")
30 |
31 | [node name="StaticBody3D" type="StaticBody3D" parent="."]
32 | transform = Transform3D(0.707107, -0.707107, 3.48787e-16, 0.707107, 0.707107, -3.48787e-16, 1.60554e-24, 4.93259e-16, 1, 0, 0, 0)
33 |
34 | [node name="MeshInstance3D" type="MeshInstance3D" parent="StaticBody3D"]
35 | mesh = SubResource("BoxMesh_i4leg")
36 | skeleton = NodePath("../../..")
37 |
38 | [node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D"]
39 | shape = SubResource("BoxShape3D_go6lu")
40 |
41 | [node name="Axis" type="MeshInstance3D" parent="."]
42 | transform = Transform3D(1, 0, -1.5246e-23, -1.5246e-23, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0)
43 | mesh = SubResource("CapsuleMesh_g86my")
44 | surface_material_override/0 = SubResource("StandardMaterial3D_csd04")
45 |
46 | [node name="MeshInstance3D" type="MeshInstance3D" parent="."]
47 | transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 2.08165e-12, 2.08165e-12, -0.520123)
48 | mesh = SubResource("CylinderMesh_bpiv6")
49 | surface_material_override/0 = SubResource("StandardMaterial3D_lioj3")
50 |
51 | [node name="sound" type="AudioStreamPlayer3D" parent="."]
52 | stream = ExtResource("2_gq8rv")
53 |
54 | [connection signal="input_event" from="StaticBody3D" to="." method="_on_static_body_3d_input_event"]
55 |
--------------------------------------------------------------------------------
/Godot_Project/examples/physics_toy/prefabs/emitter.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=9 format=3 uid="uid://43rktd62aem5"]
2 |
3 | [ext_resource type="Script" path="res://examples/physics_toy/scripts/emitter.gd" id="1_uynco"]
4 | [ext_resource type="PackedScene" uid="uid://ca4r4hmmhcldf" path="res://examples/physics_toy/prefabs/ball.tscn" id="2_pn07b"]
5 | [ext_resource type="Script" path="res://examples/physics_toy/scripts/tween_effect.gd" id="3_31efd"]
6 |
7 | [sub_resource type="CylinderMesh" id="CylinderMesh_1k1ua"]
8 | top_radius = 0.71
9 | bottom_radius = 0.71
10 | height = 20.0
11 | radial_segments = 32
12 |
13 | [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_nw64p"]
14 | albedo_color = Color(0.796078, 0.796078, 0.796078, 1)
15 | metallic = 0.61
16 | metallic_specular = 0.91
17 |
18 | [sub_resource type="CylinderMesh" id="CylinderMesh_wdcd0"]
19 | top_radius = 0.848
20 | bottom_radius = 1.297
21 | height = 0.4
22 | radial_segments = 32
23 |
24 | [sub_resource type="CylinderMesh" id="CylinderMesh_yjm4t"]
25 | top_radius = 0.0
26 | bottom_radius = 1.919
27 | height = 1.844
28 | radial_segments = 32
29 |
30 | [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_opcwc"]
31 | albedo_color = Color(0.976471, 0.141176, 0.282353, 1)
32 |
33 | [node name="Emitter" type="Node3D"]
34 | script = ExtResource("1_uynco")
35 | emits = ExtResource("2_pn07b")
36 |
37 | [node name="Meshes" type="Node3D" parent="."]
38 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.18389, 0)
39 |
40 | [node name="Pipe" type="MeshInstance3D" parent="Meshes"]
41 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 8.9623, 0)
42 | mesh = SubResource("CylinderMesh_1k1ua")
43 | skeleton = NodePath("../..")
44 | surface_material_override/0 = SubResource("StandardMaterial3D_nw64p")
45 |
46 | [node name="Ridges" type="MeshInstance3D" parent="Meshes"]
47 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.63721, 0)
48 | mesh = SubResource("CylinderMesh_wdcd0")
49 | skeleton = NodePath("../..")
50 |
51 | [node name="Ridges2" type="MeshInstance3D" parent="Meshes"]
52 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.38902, 0)
53 | mesh = SubResource("CylinderMesh_wdcd0")
54 | skeleton = NodePath("../..")
55 |
56 | [node name="Ridges3" type="MeshInstance3D" parent="Meshes"]
57 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.12106, 0)
58 | mesh = SubResource("CylinderMesh_wdcd0")
59 | skeleton = NodePath("../..")
60 |
61 | [node name="BottomFunnel" type="MeshInstance3D" parent="Meshes"]
62 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.79358, 0)
63 | mesh = SubResource("CylinderMesh_yjm4t")
64 | skeleton = NodePath("../..")
65 | surface_material_override/0 = SubResource("StandardMaterial3D_opcwc")
66 | script = ExtResource("3_31efd")
67 | amount = 1.25
68 | duration = 0.15
69 |
70 | [connection signal="emitted_node" from="." to="Meshes/BottomFunnel" method="trigger"]
71 |
--------------------------------------------------------------------------------
/Godot_Project/examples/physics_toy/prefabs/spring.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=5 format=3 uid="uid://h2hleasl7813"]
2 |
3 | [ext_resource type="Script" path="res://examples/physics_toy/scripts/spring.gd" id="1_v5ipw"]
4 | [ext_resource type="PackedScene" uid="uid://bk2vmbinktj6m" path="res://examples/physics_toy/models/spring_rigged/scene.gltf" id="2_ud3c5"]
5 | [ext_resource type="AudioStream" uid="uid://iefg5x3eq1oa" path="res://examples/physics_toy/sounds/540788__magnuswaker__boing-1.mp3" id="3_kp288"]
6 |
7 | [sub_resource type="CylinderShape3D" id="CylinderShape3D_5b6jk"]
8 | height = 0.270341
9 | radius = 0.164377
10 |
11 | [node name="Spring" type="Node3D"]
12 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, -2.47231, 5.20412e-12)
13 | script = ExtResource("1_v5ipw")
14 | spring_strength = 2.0
15 |
16 | [node name="SpringMesh" parent="." instance=ExtResource("2_ud3c5")]
17 | transform = Transform3D(1.5, 0, 0, 0, 1.5, 0, 0, 0, 1.5, 0, 0, -3.12247e-12)
18 |
19 | [node name="Area3D" type="Area3D" parent="."]
20 |
21 | [node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D"]
22 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.15636, 0)
23 | shape = SubResource("CylinderShape3D_5b6jk")
24 |
25 | [node name="audio" type="AudioStreamPlayer3D" parent="."]
26 | stream = ExtResource("3_kp288")
27 | volume_db = -8.571
28 |
29 | [connection signal="body_entered" from="Area3D" to="." method="_on_area_3d_body_entered"]
30 | [connection signal="body_exited" from="Area3D" to="." method="_on_area_3d_body_exited"]
31 |
--------------------------------------------------------------------------------
/Godot_Project/examples/physics_toy/prefabs/water_wheel.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=9 format=3 uid="uid://cthxmr6qmrukk"]
2 |
3 | [ext_resource type="Script" path="res://examples/physics_toy/scripts/water_wheel.gd" id="1_dt4w6"]
4 | [ext_resource type="Script" path="res://examples/physics_toy/scripts/RotationSound.gd" id="2_56gtp"]
5 | [ext_resource type="AudioStream" uid="uid://c0qdwcat7rg0u" path="res://examples/physics_toy/sounds/108538__jfreem3__squeekywalkl.mp3" id="3_bsh51"]
6 |
7 | [sub_resource type="BoxShape3D" id="BoxShape3D_64n2y"]
8 | size = Vector3(1.5, 0.1, 1)
9 |
10 | [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_11ybi"]
11 | albedo_color = Color(1, 0.435294, 1, 1)
12 |
13 | [sub_resource type="BoxMesh" id="BoxMesh_xh8u7"]
14 | material = SubResource("StandardMaterial3D_11ybi")
15 | size = Vector3(1.5, 0.1, 1)
16 |
17 | [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_wmsvf"]
18 | albedo_color = Color(1, 1, 0.447059, 1)
19 |
20 | [sub_resource type="CylinderMesh" id="CylinderMesh_o8hfc"]
21 | material = SubResource("StandardMaterial3D_wmsvf")
22 | top_radius = 0.08
23 | bottom_radius = 0.08
24 | height = 1.283
25 | radial_segments = 16
26 |
27 | [node name="WaterWheel" type="Node3D"]
28 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.08165e-12, 2.08165e-12, 2.08165e-12)
29 | script = ExtResource("1_dt4w6")
30 |
31 | [node name="HingeJoint3D" type="HingeJoint3D" parent="."]
32 | node_a = NodePath("../RigidBody3D")
33 | angular_limit/enable = true
34 | angular_limit/upper = 3.14159
35 | angular_limit/lower = -3.14159
36 |
37 | [node name="RigidBody3D" type="RigidBody3D" parent="."]
38 | angular_damp = 1.15
39 |
40 | [node name="CollisionShape3D" type="CollisionShape3D" parent="RigidBody3D"]
41 | shape = SubResource("BoxShape3D_64n2y")
42 |
43 | [node name="MeshInstance3D" type="MeshInstance3D" parent="RigidBody3D"]
44 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0120463, -0.0241253, 0.00814342)
45 | mesh = SubResource("BoxMesh_xh8u7")
46 |
47 | [node name="CollisionShape3D2" type="CollisionShape3D" parent="RigidBody3D"]
48 | transform = Transform3D(-4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0, 1, 0, 0, 0)
49 | shape = SubResource("BoxShape3D_64n2y")
50 |
51 | [node name="MeshInstance3D2" type="MeshInstance3D" parent="RigidBody3D"]
52 | transform = Transform3D(-4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0, 1, 0, 0, 0)
53 | mesh = SubResource("BoxMesh_xh8u7")
54 |
55 | [node name="AxisMesh" type="MeshInstance3D" parent="RigidBody3D"]
56 | transform = Transform3D(1, 0, -1.5246e-23, -1.5246e-23, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0)
57 | mesh = SubResource("CylinderMesh_o8hfc")
58 |
59 | [node name="RotationSound" type="Node" parent="RigidBody3D"]
60 | script = ExtResource("2_56gtp")
61 |
62 | [node name="AudioStreamPlayer3D" type="AudioStreamPlayer3D" parent="RigidBody3D/RotationSound"]
63 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.08165e-12, 2.08165e-12, 2.08165e-12)
64 | stream = ExtResource("3_bsh51")
65 | volume_db = -14.546
66 |
67 | [connection signal="input_event" from="RigidBody3D" to="." method="_on_rigid_body_3d_input_event"]
68 |
--------------------------------------------------------------------------------
/Godot_Project/examples/physics_toy/scripts/Editor.gd:
--------------------------------------------------------------------------------
1 | class_name Editor
2 |
3 | extends Node3D
4 |
5 | @onready var DepthPlane: Node3D = $DepthPlane
6 |
7 | var selection: Node3D
8 | var t: SceneTreeTimer
9 |
10 | func move_selection(move_vector: Vector3):
11 | if not selection:
12 | printerr("No selection")
13 | return
14 |
15 | selection.position += move_vector
16 |
17 |
18 |
19 | func _on_depth_plane_timer():
20 | DepthPlane.hide()
21 |
22 | func _on_hud_on_depth(zero_to_one):
23 | DepthPlane.show()
24 | if not DepthPlane:
25 | printerr("Expected child named 'DepthPlane'")
26 | else:
27 | if t: t.timeout.disconnect(_on_depth_plane_timer)
28 | t = get_tree().create_timer(0.8)
29 | t.timeout.connect(_on_depth_plane_timer)
30 |
31 | const DEPTH_RANGE = 3.0
32 | DepthPlane.position.z = -zero_to_one * DEPTH_RANGE + DEPTH_RANGE / 2.0
33 | # print(zero_to_one, " -> ", DepthPlane.position.z)
34 |
35 |
--------------------------------------------------------------------------------
/Godot_Project/examples/physics_toy/scripts/PhysicsCollisionSound.gd:
--------------------------------------------------------------------------------
1 | extends Node
2 |
3 | @onready var parentRigidBody: RigidBody3D = get_parent()
4 | @onready var sound: AudioStreamPlayer3D = $sound
5 |
6 | # Called when the node enters the scene tree for the first time.
7 | func _ready():
8 | if not parentRigidBody:
9 | printerr("Place 'PhysicsCollisionSound' as child of a RigidBody3D.")
10 | return
11 | if not sound:
12 | printerr("Expecting an AudioStreamPlayer3D as a child named 'sound'")
13 | return
14 |
15 |
16 | func _on_ball_rigid_body_3d_body_entered(body: PhysicsBody3D):
17 | # print("enter ", body)
18 | sound.unit_size = parentRigidBody.linear_velocity.length()
19 | sound.play()
20 |
21 |
--------------------------------------------------------------------------------
/Godot_Project/examples/physics_toy/scripts/RotationSound.gd:
--------------------------------------------------------------------------------
1 | extends Node
2 |
3 | @onready var target: Node3D = get_parent()
4 | @onready var sound: AudioStreamPlayer3D = $AudioStreamPlayer3D
5 |
6 | var new_val: int = 0
7 | var old_val: int = 0
8 |
9 | func _process(delta):
10 | var new_val = int(target.rotation.z / (PI * 0.25))
11 | if new_val != old_val:
12 | sound.play()
13 | old_val = new_val
14 |
15 |
--------------------------------------------------------------------------------
/Godot_Project/examples/physics_toy/scripts/ball.gd:
--------------------------------------------------------------------------------
1 | extends RigidBody3D
2 |
3 | @export var whoosh_sound: AudioStreamPlayer3D
4 |
5 | signal did_acccel()
6 |
7 | func _on_input_event(camera, event, position, normal, shape_idx):
8 | if event is InputEventMouseButton and event.pressed:
9 | apply_central_impulse(linear_velocity)
10 | did_acccel.emit()
11 |
--------------------------------------------------------------------------------
/Godot_Project/examples/physics_toy/scripts/diagonal_toggle_board.gd:
--------------------------------------------------------------------------------
1 | extends Node3D
2 |
3 | @onready var body = $StaticBody3D
4 | @onready var sound: AudioStreamPlayer3D = $sound
5 |
6 | func _on_static_body_3d_input_event(_camera, event, _position, _normal, _shape_idx):
7 | if event is InputEventMouseButton and event.pressed:
8 |
9 | var targetRotationDegZ: float = 0
10 | if body.rotation_degrees.z > 0:
11 | targetRotationDegZ = -45
12 | else:
13 | targetRotationDegZ = 45
14 | var targetRotationDegrees: Vector3 = Vector3(0, 0, targetRotationDegZ)
15 | # body.rotation_degrees = targetRotationDegrees
16 |
17 | var t = create_tween().tween_property(body, "rotation_degrees", targetRotationDegrees, 0.2)
18 | t.set_ease(Tween.EASE_OUT)
19 | t.set_trans(Tween.TRANS_SPRING)
20 |
21 | if sound: sound.play()
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Godot_Project/examples/physics_toy/scripts/emitter.gd:
--------------------------------------------------------------------------------
1 | extends Node3D
2 |
3 | @export var emits: PackedScene
4 |
5 | signal emitted_node(node: Node3D)
6 |
7 | func _ready():
8 | while true:
9 | await get_tree().create_timer(randf_range(2.0, 5.0)).timeout
10 | var obj := emits.instantiate() as Node3D
11 | get_parent().add_child(obj)
12 | obj.global_position = global_position
13 |
14 | emitted_node.emit(obj)
15 |
--------------------------------------------------------------------------------
/Godot_Project/examples/physics_toy/scripts/out_of_bounds.gd:
--------------------------------------------------------------------------------
1 | extends Node
2 | ## Removes its parent node when it goes out of bounds.
3 |
4 | ## When this script's parent node falls under this position, we queue_free it
5 | @export var queueFreeUnderY: float = -10
6 |
7 | func _ready():
8 | var parent := get_parent()
9 | while parent and parent.is_inside_tree():
10 | await get_tree().create_timer(0.5 + randf() * 0.5).timeout
11 | if parent.global_position.y < queueFreeUnderY:
12 | parent.queue_free()
13 | break
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Godot_Project/examples/physics_toy/scripts/spring.gd:
--------------------------------------------------------------------------------
1 | extends Node3D
2 |
3 |
4 | @export var spring_strength: float = 2.2
5 | @export var manual_spring_factor: bool = false
6 | @onready var audio: AudioStreamPlayer3D = $audio
7 |
8 | var bodies = {}
9 | var skeleton: Skeleton3D
10 | var bone_idx: int = -1
11 | var orig_pose_pos: Vector3 = Vector3.ZERO
12 | var physics_factor: float = 1 # how much up the spring is based on physics collisions
13 |
14 | func _on_area_3d_body_entered(body):
15 | if body is RigidBody3D and not bodies.has(body):
16 |
17 | var direction: Vector3 = global_basis.y * -body.linear_velocity.y
18 | body.apply_impulse(direction * spring_strength)
19 | bodies[body] = true
20 |
21 | if audio:
22 | audio.play()
23 |
24 | func _on_area_3d_body_exited(body):
25 | bodies.erase(body)
26 |
27 | func set_spring_factor(value01):
28 | if skeleton and bone_idx >= 0:
29 | var newPosePos = orig_pose_pos
30 | newPosePos.y = orig_pose_pos.y * value01
31 | skeleton.set_bone_pose_position(bone_idx, newPosePos)
32 |
33 | func _process(delta: float):
34 | if manual_spring_factor:
35 | return
36 |
37 | var old_physics_factor = physics_factor
38 |
39 | var diff := -11.0 if bodies.size() > 0 else 3.5
40 | physics_factor = clamp(physics_factor + delta * diff, 0, 1)
41 |
42 | if old_physics_factor != physics_factor:
43 | set_spring_factor(physics_factor)
44 |
45 | func _ready():
46 | var skeletons := find_children("*", "Skeleton3D")
47 | if skeletons.size() != 1:
48 | printerr("Expected exactly 1 Skeleton3D under $Spring")
49 | return
50 |
51 | skeleton = skeletons[0] as Skeleton3D
52 | #skeleton.pose_updated.connect(func():
53 | # print("pose updated")
54 | #)
55 |
56 | var topBone := skeleton.find_bone("Top_01")
57 | if topBone == -1:
58 | printerr("Could not find Top_01 bone in spring")
59 | return
60 |
61 | bone_idx = topBone
62 | orig_pose_pos = skeleton.get_bone_pose_position(bone_idx)
63 |
--------------------------------------------------------------------------------
/Godot_Project/examples/physics_toy/scripts/spring_test.gd:
--------------------------------------------------------------------------------
1 | extends Node3D
2 |
3 | @onready var Spring: Node3D = $Spring
4 | var time: float = 0
5 |
6 | func _process(delta: float):
7 | time += delta
8 | Spring.set_spring_factor((sin(sin(time) * 3) + 1) * 0.5)
9 |
--------------------------------------------------------------------------------
/Godot_Project/examples/physics_toy/scripts/tween_effect.gd:
--------------------------------------------------------------------------------
1 | extends MeshInstance3D
2 |
3 | @export var property = "scale"
4 | @export var amount: float = 2.0
5 | @export var duration: float = 0.2
6 |
7 | func trigger(_node: Node3D):
8 | var orig_value := scale
9 | var final_value := orig_value * amount
10 |
11 | var t := create_tween()
12 | t.tween_property(self, property, final_value, duration * 0.5)
13 | t.tween_property(self, property, orig_value, duration * 0.5)
14 |
15 |
--------------------------------------------------------------------------------
/Godot_Project/examples/physics_toy/scripts/water_wheel.gd:
--------------------------------------------------------------------------------
1 | extends Node3D
2 |
3 | @onready var rb = $RigidBody3D
4 | @onready var hinge: HingeJoint3D = $HingeJoint3D
5 | @onready var axis_mesh: MeshInstance3D = $RigidBody3D/AxisMesh
6 |
7 | var orig_angular_damp: Vector2 = Vector2.ZERO
8 | var target_damp: Vector2 = Vector2.ZERO
9 |
10 | var SPEED_TO_CHANGE_ANGULAR_DAMP = 6.0
11 |
12 | func _ready():
13 | orig_angular_damp = Vector2(rb.angular_damp, 0)
14 |
15 | func _process(delta):
16 | var current := Vector2(rb.angular_damp, 0)
17 | if current != target_damp:
18 | rb.angular_damp = current.lerp(target_damp, delta * SPEED_TO_CHANGE_ANGULAR_DAMP).x
19 | if abs(rb.angular_damp - target_damp.x) < 0.001:
20 | rb.angular_damp = target_damp.x
21 |
22 | func _on_rigid_body_3d_input_event(camera, event, position, normal, shape_idx):
23 | if event is InputEventMouseButton:
24 | if event.pressed:
25 | target_damp = Vector2(40.0, 0)
26 | else:
27 | target_damp = orig_angular_damp
28 |
--------------------------------------------------------------------------------
/Godot_Project/examples/physics_toy/sounds/108538__jfreem3__squeekywalkl.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/physics_toy/sounds/108538__jfreem3__squeekywalkl.mp3
--------------------------------------------------------------------------------
/Godot_Project/examples/physics_toy/sounds/108538__jfreem3__squeekywalkl.mp3.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="mp3"
4 | type="AudioStreamMP3"
5 | uid="uid://c0qdwcat7rg0u"
6 | path="res://.godot/imported/108538__jfreem3__squeekywalkl.mp3-6378bd58bc0c6359c567a6d750c4cfe0.mp3str"
7 |
8 | [deps]
9 |
10 | source_file="res://examples/physics_toy/sounds/108538__jfreem3__squeekywalkl.mp3"
11 | dest_files=["res://.godot/imported/108538__jfreem3__squeekywalkl.mp3-6378bd58bc0c6359c567a6d750c4cfe0.mp3str"]
12 |
13 | [params]
14 |
15 | loop=false
16 | loop_offset=0
17 | bpm=0
18 | beat_count=0
19 | bar_beats=4
20 |
--------------------------------------------------------------------------------
/Godot_Project/examples/physics_toy/sounds/163398__baryy__squeeky-turn.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/physics_toy/sounds/163398__baryy__squeeky-turn.mp3
--------------------------------------------------------------------------------
/Godot_Project/examples/physics_toy/sounds/163398__baryy__squeeky-turn.mp3.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="mp3"
4 | type="AudioStreamMP3"
5 | uid="uid://dw01pxsyuo5t"
6 | path="res://.godot/imported/163398__baryy__squeeky-turn.mp3-a638930815cfafaef48cc38dd7f5e5c0.mp3str"
7 |
8 | [deps]
9 |
10 | source_file="res://examples/physics_toy/sounds/163398__baryy__squeeky-turn.mp3"
11 | dest_files=["res://.godot/imported/163398__baryy__squeeky-turn.mp3-a638930815cfafaef48cc38dd7f5e5c0.mp3str"]
12 |
13 | [params]
14 |
15 | loop=false
16 | loop_offset=0
17 | bpm=0
18 | beat_count=0
19 | bar_beats=4
20 |
--------------------------------------------------------------------------------
/Godot_Project/examples/physics_toy/sounds/332661__reitanna__big-thud.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/physics_toy/sounds/332661__reitanna__big-thud.mp3
--------------------------------------------------------------------------------
/Godot_Project/examples/physics_toy/sounds/332661__reitanna__big-thud.mp3.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="mp3"
4 | type="AudioStreamMP3"
5 | uid="uid://d06yj67igh28l"
6 | path="res://.godot/imported/332661__reitanna__big-thud.mp3-2b855480e5d64991fe0eeba62ad4bfd1.mp3str"
7 |
8 | [deps]
9 |
10 | source_file="res://examples/physics_toy/sounds/332661__reitanna__big-thud.mp3"
11 | dest_files=["res://.godot/imported/332661__reitanna__big-thud.mp3-2b855480e5d64991fe0eeba62ad4bfd1.mp3str"]
12 |
13 | [params]
14 |
15 | loop=false
16 | loop_offset=0
17 | bpm=0
18 | beat_count=0
19 | bar_beats=4
20 |
--------------------------------------------------------------------------------
/Godot_Project/examples/physics_toy/sounds/540788__magnuswaker__boing-1.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/physics_toy/sounds/540788__magnuswaker__boing-1.mp3
--------------------------------------------------------------------------------
/Godot_Project/examples/physics_toy/sounds/540788__magnuswaker__boing-1.mp3.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="mp3"
4 | type="AudioStreamMP3"
5 | uid="uid://iefg5x3eq1oa"
6 | path="res://.godot/imported/540788__magnuswaker__boing-1.mp3-5748be7a361ee5f6a9ead8c36afd397d.mp3str"
7 |
8 | [deps]
9 |
10 | source_file="res://examples/physics_toy/sounds/540788__magnuswaker__boing-1.mp3"
11 | dest_files=["res://.godot/imported/540788__magnuswaker__boing-1.mp3-5748be7a361ee5f6a9ead8c36afd397d.mp3str"]
12 |
13 | [params]
14 |
15 | loop=false
16 | loop_offset=0
17 | bpm=0
18 | beat_count=0
19 | bar_beats=4
20 |
--------------------------------------------------------------------------------
/Godot_Project/examples/physics_toy/sounds/683101__florianreichelt__quick-woosh.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/physics_toy/sounds/683101__florianreichelt__quick-woosh.mp3
--------------------------------------------------------------------------------
/Godot_Project/examples/physics_toy/sounds/683101__florianreichelt__quick-woosh.mp3.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="mp3"
4 | type="AudioStreamMP3"
5 | uid="uid://dygabhvbnucxw"
6 | path="res://.godot/imported/683101__florianreichelt__quick-woosh.mp3-f3ee75749bde70e2fab9e44f92772ca4.mp3str"
7 |
8 | [deps]
9 |
10 | source_file="res://examples/physics_toy/sounds/683101__florianreichelt__quick-woosh.mp3"
11 | dest_files=["res://.godot/imported/683101__florianreichelt__quick-woosh.mp3-f3ee75749bde70e2fab9e44f92772ca4.mp3str"]
12 |
13 | [params]
14 |
15 | loop=false
16 | loop_offset=0
17 | bpm=0
18 | beat_count=0
19 | bar_beats=4
20 |
--------------------------------------------------------------------------------
/Godot_Project/examples/physics_toy/sounds/71774__lg__switch-22.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/physics_toy/sounds/71774__lg__switch-22.mp3
--------------------------------------------------------------------------------
/Godot_Project/examples/physics_toy/sounds/71774__lg__switch-22.mp3.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="mp3"
4 | type="AudioStreamMP3"
5 | uid="uid://cyi7jwxbakwsc"
6 | path="res://.godot/imported/71774__lg__switch-22.mp3-46d58f745219dfc6db870fcaa75ba0e7.mp3str"
7 |
8 | [deps]
9 |
10 | source_file="res://examples/physics_toy/sounds/71774__lg__switch-22.mp3"
11 | dest_files=["res://.godot/imported/71774__lg__switch-22.mp3-46d58f745219dfc6db870fcaa75ba0e7.mp3str"]
12 |
13 | [params]
14 |
15 | loop=false
16 | loop_offset=0
17 | bpm=0
18 | beat_count=0
19 | bar_beats=4
20 |
--------------------------------------------------------------------------------
/Godot_Project/examples/rigged_models/example_rigged_models.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=9 format=3 uid="uid://bfecatyesa0qe"]
2 |
3 | [ext_resource type="PackedScene" uid="uid://biunegs8tkvn0" path="res://addons/godot_vision/VisionVolumeCamera.tscn" id="1_yurvt"]
4 | [ext_resource type="Script" path="res://examples/common/scripts/draggable.gd" id="2_b77b2"]
5 | [ext_resource type="PackedScene" uid="uid://dju3kiiixe4x7" path="res://examples/rigged_models/models/low_poly_alpaca/scene.gltf" id="2_dl1bm"]
6 | [ext_resource type="Script" path="res://examples/common/scripts/auto_play_anim.gd" id="3_p0m65"]
7 | [ext_resource type="Script" path="res://examples/physics_toy/scripts/spring_test.gd" id="4_1u621"]
8 | [ext_resource type="PackedScene" uid="uid://h2hleasl7813" path="res://examples/physics_toy/prefabs/spring.tscn" id="5_vr207"]
9 |
10 | [sub_resource type="BoxShape3D" id="BoxShape3D_n3blw"]
11 | size = Vector3(1.43, 6.35394, 4.78)
12 |
13 | [sub_resource type="CylinderShape3D" id="CylinderShape3D_arjfy"]
14 | height = 4.238
15 | radius = 1.708
16 |
17 | [node name="Node3D" type="Node3D"]
18 |
19 | [node name="VisionVolumeCamera" parent="." instance=ExtResource("1_yurvt")]
20 |
21 | [node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
22 | transform = Transform3D(0.190262, 0.94702, -0.258754, -0.561008, 0.321175, 0.762966, 0.805649, 6.40326e-09, 0.592393, 0, 0, 0)
23 |
24 | [node name="Objects" type="Node3D" parent="."]
25 |
26 | [node name="Llama Draggable" type="AnimatableBody3D" parent="Objects"]
27 | transform = Transform3D(0.383022, 0, -0.923739, 0, 1, 0, 0.923739, 0, 0.383022, -0.564281, 0, 0)
28 | input_capture_on_drag = true
29 | script = ExtResource("2_b77b2")
30 |
31 | [node name="llama" parent="Objects/Llama Draggable" instance=ExtResource("2_dl1bm")]
32 | transform = Transform3D(1.22296, 0, 0, 0, 1.22296, 0, 0, 0, 1.22296, 2.08165e-12, -2.08652, 2.08165e-12)
33 | script = ExtResource("3_p0m65")
34 | animation_name = "Walk"
35 |
36 | [node name="CollisionShape3D" type="CollisionShape3D" parent="Objects/Llama Draggable"]
37 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.05392, 0.427021)
38 | shape = SubResource("BoxShape3D_n3blw")
39 |
40 | [node name="Spring Draggable" type="AnimatableBody3D" parent="Objects"]
41 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4.74511, -1.29528, 2.08165e-12)
42 | input_capture_on_drag = true
43 | script = ExtResource("2_b77b2")
44 |
45 | [node name="SpringTest" type="Node3D" parent="Objects/Spring Draggable"]
46 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -2.08165e-12)
47 | script = ExtResource("4_1u621")
48 |
49 | [node name="Spring" parent="Objects/Spring Draggable/SpringTest" instance=ExtResource("5_vr207")]
50 | transform = Transform3D(9.23965, 0, 0, 0, 9.23965, 0, 0, 0, 9.23965, 2.08165e-12, 2.08165e-12, 2.08165e-12)
51 | manual_spring_factor = true
52 |
53 | [node name="CollisionShape3D" type="CollisionShape3D" parent="Objects/Spring Draggable"]
54 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.44389, 0)
55 | shape = SubResource("CylinderShape3D_arjfy")
56 |
--------------------------------------------------------------------------------
/Godot_Project/examples/rigged_models/models/low_poly_alpaca/license.txt:
--------------------------------------------------------------------------------
1 | Model Information:
2 | * title: Low poly Alpaca
3 | * source: https://sketchfab.com/3d-models/low-poly-alpaca-6fff35b671464bea80baae4f53111aae
4 | * author: kenchoo (https://sketchfab.com/kenchoo)
5 |
6 | Model License:
7 | * license type: SKETCHFAB Standard (https://sketchfab.com/licenses)
8 | * requirements: Under basic restrictions, use worldwide, on all types of media, commercially or not, and in all types of derivative works
9 |
--------------------------------------------------------------------------------
/Godot_Project/examples/rigged_models/models/low_poly_alpaca/scene.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/Godot_Project/examples/rigged_models/models/low_poly_alpaca/scene.bin
--------------------------------------------------------------------------------
/Godot_Project/examples/rigged_models/models/low_poly_alpaca/scene.gltf.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="scene"
4 | importer_version=1
5 | type="PackedScene"
6 | uid="uid://dju3kiiixe4x7"
7 | path="res://.godot/imported/scene.gltf-f78e6d43579c11b8fb5f7d78cdbb877c.scn"
8 |
9 | [deps]
10 |
11 | source_file="res://examples/rigged_models/models/low_poly_alpaca/scene.gltf"
12 | dest_files=["res://.godot/imported/scene.gltf-f78e6d43579c11b8fb5f7d78cdbb877c.scn"]
13 |
14 | [params]
15 |
16 | nodes/root_type=""
17 | nodes/root_name=""
18 | nodes/apply_root_scale=true
19 | nodes/root_scale=1.0
20 | nodes/import_as_skeleton_bones=false
21 | meshes/ensure_tangents=true
22 | meshes/generate_lods=true
23 | meshes/create_shadow_meshes=true
24 | meshes/light_baking=1
25 | meshes/lightmap_texel_size=0.2
26 | meshes/force_disable_compression=false
27 | skins/use_named_skins=true
28 | animation/import=true
29 | animation/fps=30
30 | animation/trimming=false
31 | animation/remove_immutable_tracks=true
32 | animation/import_rest_as_RESET=false
33 | import_script/path=""
34 | _subresources={}
35 | gltf/naming_version=1
36 | gltf/embedded_image_handling=1
37 |
--------------------------------------------------------------------------------
/Godot_Project/examples/shapes/entities/box/box.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=3 format=3 uid="uid://bdo18a3tpxda1"]
2 |
3 | [ext_resource type="Material" uid="uid://ctm5wb05otmn4" path="res://examples/common/materials/green.tres" id="1_b1op1"]
4 |
5 | [sub_resource type="BoxShape3D" id="BoxShape3D_ouvhb"]
6 |
7 | [node name="Box" type="RigidBody3D"]
8 |
9 | [node name="Shape" type="CollisionShape3D" parent="."]
10 | shape = SubResource("BoxShape3D_ouvhb")
11 |
12 | [node name="Mesh" type="CSGBox3D" parent="."]
13 | material = ExtResource("1_b1op1")
14 |
--------------------------------------------------------------------------------
/Godot_Project/examples/shapes/entities/capsule/capsule.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=3 format=3 uid="uid://cxj20ksax0cnv"]
2 |
3 | [ext_resource type="Material" uid="uid://ctm5wb05otmn4" path="res://examples/common/materials/green.tres" id="1_saoys"]
4 |
5 | [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_idxhg"]
6 |
7 | [node name="Capsule" type="RigidBody3D"]
8 |
9 | [node name="Shape" type="CollisionShape3D" parent="."]
10 | shape = SubResource("CapsuleShape3D_idxhg")
11 |
12 | [node name="Mesh_Top" type="CSGSphere3D" parent="."]
13 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0)
14 | radial_segments = 36
15 | rings = 18
16 | material = ExtResource("1_saoys")
17 |
18 | [node name="Mesh_Middle" type="CSGCylinder3D" parent="."]
19 | height = 1.0
20 | sides = 36
21 | material = ExtResource("1_saoys")
22 |
23 | [node name="Mesh_Bottom" type="CSGSphere3D" parent="."]
24 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.5, 0)
25 | radial_segments = 36
26 | rings = 18
27 | material = ExtResource("1_saoys")
28 |
--------------------------------------------------------------------------------
/Godot_Project/examples/shapes/entities/concave_polygon/concave_polygon.obj:
--------------------------------------------------------------------------------
1 | o Polygon
2 | v 3.789655 -3.795167 2.753308
3 | v -1.447482 -3.795168 4.454987
4 | v -4.684247 -3.795164 0.000000
5 | v -1.447482 -3.795168 -4.454987
6 | v 3.789655 -3.795167 -2.753308
7 | v 2.456388 0.447220 7.560112
8 | v -6.431032 0.447220 4.672363
9 | v -6.431032 0.447220 -4.672363
10 | v 2.456388 0.447220 -7.560112
11 | v 7.949179 0.447216 0.000000
12 | v 1.376693 -3.873686 4.236924
13 | v 4.454987 -3.873684 0.000000
14 | v -3.604151 -3.873684 2.618564
15 | v -3.604151 -3.873684 -2.618564
16 | v 1.376693 -3.873686 -4.236924
17 | v 8.452489 0.000000 2.746338
18 | v 8.452489 0.000000 -2.746338
19 | v -0.000000 0.000000 8.887460
20 | v 5.223921 0.000000 7.190104
21 | v -8.452489 0.000000 2.746338
22 | v -5.223921 0.000000 7.190104
23 | v -5.223921 0.000000 -7.190104
24 | v -8.452489 0.000000 -2.746338
25 | v 5.223921 0.000000 -7.190104
26 | v -0.000000 0.000000 -8.887460
27 | v 6.116256 0.525736 4.443703
28 | v -2.336236 0.525738 7.190059
29 | v -7.560100 0.525736 0.000000
30 | v -2.336236 0.525738 -7.190059
31 | v 6.116256 0.525736 -4.443703
32 | v 0.162456 -1.176364 0.499995
33 | v 0.525730 -1.176367 0.000000
34 | v -0.425323 -1.176364 0.309011
35 | v -0.425323 -1.176364 -0.309011
36 | v 0.162456 -1.176364 -0.499995
37 | s off
38 | f 1 12 16
39 | f 2 11 18
40 | f 3 13 20
41 | f 4 14 22
42 | f 5 15 24
43 | f 1 16 19
44 | f 2 18 21
45 | f 3 20 23
46 | f 4 22 25
47 | f 5 24 17
48 | f 31 6 26 10 32
49 | f 27 6 31 33 7
50 | f 32 35 34 33 31
51 | f 30 9 35 32 10
52 | f 34 35 9 29 8
53 | f 28 7 33 34 8
54 | f 17 30 10
55 | f 17 24 30
56 | f 24 9 30
57 | f 25 29 9
58 | f 25 22 29
59 | f 22 8 29
60 | f 23 28 8
61 | f 23 20 28
62 | f 20 7 28
63 | f 21 27 7
64 | f 21 18 27
65 | f 18 6 27
66 | f 19 26 6
67 | f 19 16 26
68 | f 16 10 26
69 | f 24 25 9
70 | f 24 15 25
71 | f 15 4 25
72 | f 22 23 8
73 | f 22 14 23
74 | f 14 3 23
75 | f 20 21 7
76 | f 20 13 21
77 | f 13 2 21
78 | f 18 19 6
79 | f 18 11 19
80 | f 11 1 19
81 | f 16 17 10
82 | f 16 12 17
83 | f 12 5 17
84 | f 12 1 11 2 13 3 14 4 15 5
85 |
--------------------------------------------------------------------------------
/Godot_Project/examples/shapes/entities/concave_polygon/concave_polygon.obj.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="wavefront_obj"
4 | importer_version=1
5 | type="Mesh"
6 | uid="uid://dkdpdynr0sndd"
7 | path="res://.godot/imported/concave_polygon.obj-52aac71a9719965a3edd21721c643c76.mesh"
8 |
9 | [deps]
10 |
11 | files=["res://.godot/imported/concave_polygon.obj-52aac71a9719965a3edd21721c643c76.mesh"]
12 |
13 | source_file="res://examples/shapes/entities/concave_polygon/concave_polygon.obj"
14 | dest_files=["res://.godot/imported/concave_polygon.obj-52aac71a9719965a3edd21721c643c76.mesh", "res://.godot/imported/concave_polygon.obj-52aac71a9719965a3edd21721c643c76.mesh"]
15 |
16 | [params]
17 |
18 | generate_tangents=true
19 | scale_mesh=Vector3(1, 1, 1)
20 | offset_mesh=Vector3(0, 0, 0)
21 | optimize_mesh=true
22 | force_disable_mesh_compression=false
23 |
--------------------------------------------------------------------------------
/Godot_Project/examples/shapes/entities/concave_polygon/concave_polygon.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=4 format=3 uid="uid://dosgsvakfplrm"]
2 |
3 | [ext_resource type="ArrayMesh" uid="uid://dkdpdynr0sndd" path="res://examples/shapes/entities/concave_polygon/concave_polygon.obj" id="1_dpqaf"]
4 | [ext_resource type="Material" uid="uid://3dvxsth5fn3n" path="res://examples/common/materials/brown.tres" id="2_sie7k"]
5 |
6 | [sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_08j3a"]
7 | data = PackedVector3Array(4.455, -3.8737, 0, 3.7897, -3.7952, 2.7533, 8.4525, 0, 2.7463, 1.3767, -3.8737, 4.2369, -1.4475, -3.7952, 4.455, 0, 0, 8.8875, -3.6042, -3.8737, 2.6186, -4.6842, -3.7952, 0, -8.4525, 0, 2.7463, -3.6042, -3.8737, -2.6186, -1.4475, -3.7952, -4.455, -5.2239, 0, -7.1901, 1.3767, -3.8737, -4.2369, 3.7897, -3.7952, -2.7533, 5.2239, 0, -7.1901, 8.4525, 0, 2.7463, 3.7897, -3.7952, 2.7533, 5.2239, 0, 7.1901, 0, 0, 8.8875, -1.4475, -3.7952, 4.455, -5.2239, 0, 7.1901, -8.4525, 0, 2.7463, -4.6842, -3.7952, 0, -8.4525, 0, -2.7463, -5.2239, 0, -7.1901, -1.4475, -3.7952, -4.455, 0, 0, -8.8875, 5.2239, 0, -7.1901, 3.7897, -3.7952, -2.7533, 8.4525, 0, -2.7463, 2.4564, 0.4472, 7.5601, 0.1625, -1.1764, 0.5, 6.1163, 0.5257, 4.4437, 6.1163, 0.5257, 4.4437, 0.1625, -1.1764, 0.5, 7.9492, 0.4472, 0, 7.9492, 0.4472, 0, 0.1625, -1.1764, 0.5, 0.5257, -1.1764, 0, 2.4564, 0.4472, 7.5601, -2.3362, 0.5257, 7.1901, 0.1625, -1.1764, 0.5, 0.1625, -1.1764, 0.5, -2.3362, 0.5257, 7.1901, -0.4253, -1.1764, 0.309, -0.4253, -1.1764, 0.309, -2.3362, 0.5257, 7.1901, -6.431, 0.4472, 4.6724, 0.1625, -1.1764, -0.5, 0.5257, -1.1764, 0, -0.4253, -1.1764, -0.309, -0.4253, -1.1764, -0.309, 0.5257, -1.1764, 0, -0.4253, -1.1764, 0.309, -0.4253, -1.1764, 0.309, 0.5257, -1.1764, 0, 0.1625, -1.1764, 0.5, 2.4564, 0.4472, -7.5601, 6.1163, 0.5257, -4.4437, 0.1625, -1.1764, -0.5, 0.1625, -1.1764, -0.5, 6.1163, 0.5257, -4.4437, 0.5257, -1.1764, 0, 0.5257, -1.1764, 0, 6.1163, 0.5257, -4.4437, 7.9492, 0.4472, 0, 0.1625, -1.1764, -0.5, -0.4253, -1.1764, -0.309, 2.4564, 0.4472, -7.5601, 2.4564, 0.4472, -7.5601, -0.4253, -1.1764, -0.309, -2.3362, 0.5257, -7.1901, -2.3362, 0.5257, -7.1901, -0.4253, -1.1764, -0.309, -6.431, 0.4472, -4.6724, -6.431, 0.4472, 4.6724, -7.5601, 0.5257, 0, -0.4253, -1.1764, 0.309, -0.4253, -1.1764, 0.309, -7.5601, 0.5257, 0, -0.4253, -1.1764, -0.309, -0.4253, -1.1764, -0.309, -7.5601, 0.5257, 0, -6.431, 0.4472, -4.6724, 6.1163, 0.5257, -4.4437, 8.4525, 0, -2.7463, 7.9492, 0.4472, 0, 5.2239, 0, -7.1901, 8.4525, 0, -2.7463, 6.1163, 0.5257, -4.4437, 2.4564, 0.4472, -7.5601, 5.2239, 0, -7.1901, 6.1163, 0.5257, -4.4437, -2.3362, 0.5257, -7.1901, 0, 0, -8.8875, 2.4564, 0.4472, -7.5601, -5.2239, 0, -7.1901, 0, 0, -8.8875, -2.3362, 0.5257, -7.1901, -6.431, 0.4472, -4.6724, -5.2239, 0, -7.1901, -2.3362, 0.5257, -7.1901, -7.5601, 0.5257, 0, -8.4525, 0, -2.7463, -6.431, 0.4472, -4.6724, -8.4525, 0, 2.7463, -8.4525, 0, -2.7463, -7.5601, 0.5257, 0, -6.431, 0.4472, 4.6724, -8.4525, 0, 2.7463, -7.5601, 0.5257, 0, -2.3362, 0.5257, 7.1901, -5.2239, 0, 7.1901, -6.431, 0.4472, 4.6724, 0, 0, 8.8875, -5.2239, 0, 7.1901, -2.3362, 0.5257, 7.1901, 2.4564, 0.4472, 7.5601, 0, 0, 8.8875, -2.3362, 0.5257, 7.1901, 6.1163, 0.5257, 4.4437, 5.2239, 0, 7.1901, 2.4564, 0.4472, 7.5601, 8.4525, 0, 2.7463, 5.2239, 0, 7.1901, 6.1163, 0.5257, 4.4437, 7.9492, 0.4472, 0, 8.4525, 0, 2.7463, 6.1163, 0.5257, 4.4437, 0, 0, -8.8875, 5.2239, 0, -7.1901, 2.4564, 0.4472, -7.5601, 1.3767, -3.8737, -4.2369, 5.2239, 0, -7.1901, 0, 0, -8.8875, -1.4475, -3.7952, -4.455, 1.3767, -3.8737, -4.2369, 0, 0, -8.8875, -8.4525, 0, -2.7463, -5.2239, 0, -7.1901, -6.431, 0.4472, -4.6724, -3.6042, -3.8737, -2.6186, -5.2239, 0, -7.1901, -8.4525, 0, -2.7463, -4.6842, -3.7952, 0, -3.6042, -3.8737, -2.6186, -8.4525, 0, -2.7463, -5.2239, 0, 7.1901, -8.4525, 0, 2.7463, -6.431, 0.4472, 4.6724, -3.6042, -3.8737, 2.6186, -8.4525, 0, 2.7463, -5.2239, 0, 7.1901, -1.4475, -3.7952, 4.455, -3.6042, -3.8737, 2.6186, -5.2239, 0, 7.1901, 5.2239, 0, 7.1901, 0, 0, 8.8875, 2.4564, 0.4472, 7.5601, 1.3767, -3.8737, 4.2369, 0, 0, 8.8875, 5.2239, 0, 7.1901, 3.7897, -3.7952, 2.7533, 1.3767, -3.8737, 4.2369, 5.2239, 0, 7.1901, 8.4525, 0, -2.7463, 8.4525, 0, 2.7463, 7.9492, 0.4472, 0, 4.455, -3.8737, 0, 8.4525, 0, 2.7463, 8.4525, 0, -2.7463, 3.7897, -3.7952, -2.7533, 4.455, -3.8737, 0, 8.4525, 0, -2.7463, 3.7897, -3.7952, 2.7533, 4.455, -3.8737, 0, 1.3767, -3.8737, 4.2369, 1.3767, -3.8737, 4.2369, 4.455, -3.8737, 0, -1.4475, -3.7952, 4.455, -1.4475, -3.7952, 4.455, 4.455, -3.8737, 0, -3.6042, -3.8737, 2.6186, -3.6042, -3.8737, 2.6186, 4.455, -3.8737, 0, -4.6842, -3.7952, 0, -4.6842, -3.7952, 0, 4.455, -3.8737, 0, -3.6042, -3.8737, -2.6186, -3.6042, -3.8737, -2.6186, 4.455, -3.8737, 0, -1.4475, -3.7952, -4.455, -1.4475, -3.7952, -4.455, 4.455, -3.8737, 0, 1.3767, -3.8737, -4.2369, 1.3767, -3.8737, -4.2369, 4.455, -3.8737, 0, 3.7897, -3.7952, -2.7533)
8 |
9 | [node name="ConcavePolygon" type="StaticBody3D"]
10 |
11 | [node name="Shape" type="CollisionShape3D" parent="."]
12 | shape = SubResource("ConcavePolygonShape3D_08j3a")
13 |
14 | [node name="Mesh" type="MeshInstance3D" parent="."]
15 | mesh = ExtResource("1_dpqaf")
16 | surface_material_override/0 = ExtResource("2_sie7k")
17 |
--------------------------------------------------------------------------------
/Godot_Project/examples/shapes/entities/convex_polygon/convex_polygon.obj:
--------------------------------------------------------------------------------
1 | o Polygon
2 | v 0.513514 -0.220629 0.259358
3 | v 0.136352 0.220629 0.526667
4 | v -0.453816 0.220629 0.259358
5 | v 0.000000 0.493334 -0.110780
6 | v -0.080145 -0.419657 0.246665
7 | v 0.209826 -0.419657 0.152446
8 | v 0.419654 -0.259363 0.000000
9 | v 0.209826 -0.419657 -0.152446
10 | v -0.259360 -0.419655 0.000000
11 | v -0.397742 -0.259364 0.348146
12 | v -0.544544 -0.259364 -0.349707
13 | v 0.129682 -0.259364 -0.399113
14 | v 0.469189 0.000000 -0.152446
15 | v -0.116825 0.000000 0.618101
16 | v -0.289975 0.000000 -0.571736
17 | v 0.289975 0.000000 -0.399116
18 | v 0.000000 0.000000 -0.703425
19 | v 0.324599 0.572665 0.246666
20 | v -0.129682 0.259364 0.399113
21 | v -0.419654 0.259363 0.000000
22 | v 0.396801 0.259364 -0.078124
23 | v -0.209826 0.419657 -0.152446
24 | v 0.080145 0.419657 -0.439906
25 | s off
26 | f 23 22 4
27 | f 14 2 19
28 | f 16 12 17
29 | f 9 5 10
30 | f 13 7 12 16
31 | f 15 17 11
32 | f 17 12 11
33 | f 22 23 17 15
34 | f 9 10 11
35 | f 20 22 15 11
36 | f 14 19 3 10
37 | f 23 16 17
38 | f 5 9 8 6
39 | f 7 8 12
40 | f 7 1 8
41 | f 1 6 8
42 | f 13 16 23 21
43 | f 5 14 10
44 | f 14 5 1 2
45 | f 19 18 3
46 | f 18 22 3
47 | f 22 20 3
48 | f 8 9 11 12
49 | f 4 18 23
50 | f 18 21 23
51 | f 18 4 22
52 | f 13 1 7
53 | f 18 2 1
54 | f 3 20 11 10
55 | f 5 6 1
56 | f 13 18 1
57 | f 2 18 19
58 | f 13 21 18
59 |
--------------------------------------------------------------------------------
/Godot_Project/examples/shapes/entities/convex_polygon/convex_polygon.obj.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="wavefront_obj"
4 | importer_version=1
5 | type="Mesh"
6 | uid="uid://chutsbwjbhepv"
7 | path="res://.godot/imported/convex_polygon.obj-970b829580f2a379e50c834a100503ba.mesh"
8 |
9 | [deps]
10 |
11 | files=["res://.godot/imported/convex_polygon.obj-970b829580f2a379e50c834a100503ba.mesh"]
12 |
13 | source_file="res://examples/shapes/entities/convex_polygon/convex_polygon.obj"
14 | dest_files=["res://.godot/imported/convex_polygon.obj-970b829580f2a379e50c834a100503ba.mesh", "res://.godot/imported/convex_polygon.obj-970b829580f2a379e50c834a100503ba.mesh"]
15 |
16 | [params]
17 |
18 | generate_tangents=true
19 | scale_mesh=Vector3(1, 1, 1)
20 | offset_mesh=Vector3(0, 0, 0)
21 | optimize_mesh=true
22 | force_disable_mesh_compression=false
23 |
--------------------------------------------------------------------------------
/Godot_Project/examples/shapes/entities/convex_polygon/convex_polygon.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=4 format=3 uid="uid://cqqkfrnystsat"]
2 |
3 | [ext_resource type="ArrayMesh" uid="uid://chutsbwjbhepv" path="res://examples/shapes/entities/convex_polygon/convex_polygon.obj" id="1_8ckho"]
4 | [ext_resource type="Material" uid="uid://ctm5wb05otmn4" path="res://examples/common/materials/green.tres" id="2_22ivk"]
5 |
6 | [sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_pht20"]
7 | points = PackedVector3Array(0.513514, -0.220629, 0.259261, 0.136317, 0.220554, 0.526645, -0.116909, -3.76701e-05, 0.618101, -0.0802454, -0.419657, 0.246584, 0.209747, -0.419657, 0.152411, 0.209747, -0.419657, -0.152487, 0.419577, -0.259386, -0.000102997, 0.469187, -3.76701e-05, -0.152487, 0.324501, 0.572665, 0.246584, -0.129751, 0.25931, 0.399097, -0.453818, 0.220554, 0.259261, -0.397787, -0.259386, 0.34813, -0.259419, -0.419657, -0.000102997, -0.544544, -0.259386, -0.349759, 0.129585, -0.259386, -0.399174, 0.289909, -3.76701e-05, -0.399174, 0.080079, 0.419582, -0.439922, 0.396792, 0.25931, -0.0782355, -8.32677e-05, 0.493306, -0.110834, -0.209913, 0.419582, -0.152487, -0.419744, 0.25931, -0.000102997, -0.290076, -3.76701e-05, -0.571738, -8.32677e-05, -3.76701e-05, -0.703425)
8 |
9 | [node name="ConvexPolygon" type="RigidBody3D"]
10 |
11 | [node name="Shape" type="CollisionShape3D" parent="."]
12 | shape = SubResource("ConvexPolygonShape3D_pht20")
13 |
14 | [node name="Mesh" type="MeshInstance3D" parent="."]
15 | mesh = ExtResource("1_8ckho")
16 | surface_material_override/0 = ExtResource("2_22ivk")
17 |
--------------------------------------------------------------------------------
/Godot_Project/examples/shapes/entities/cylinder/cylinder.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=3 format=3 uid="uid://dufmnyw4ry3c3"]
2 |
3 | [ext_resource type="Material" uid="uid://ctm5wb05otmn4" path="res://examples/common/materials/green.tres" id="1_3s2ir"]
4 |
5 | [sub_resource type="CylinderShape3D" id="CylinderShape3D_nfxxm"]
6 | height = 1.0
7 |
8 | [node name="Cylinder" type="RigidBody3D"]
9 |
10 | [node name="Shape" type="CollisionShape3D" parent="."]
11 | shape = SubResource("CylinderShape3D_nfxxm")
12 |
13 | [node name="Mesh" type="CSGCylinder3D" parent="."]
14 | height = 1.0
15 | sides = 36
16 | material = ExtResource("1_3s2ir")
17 |
--------------------------------------------------------------------------------
/Godot_Project/examples/shapes/entities/height_map/height_map.gd:
--------------------------------------------------------------------------------
1 | @tool
2 |
3 | class_name HeightMap3D extends StaticBody3D
4 |
5 | @export_node_path("CollisionShape3D")
6 | var collision_shape := NodePath():
7 | set(value):
8 | collision_shape = value
9 | _properties_changed()
10 |
11 | @export_node_path("MeshInstance3D")
12 | var mesh_instance := NodePath():
13 | set(value):
14 | mesh_instance = value
15 | _properties_changed()
16 |
17 | @export_range(4, 64, 1, "or_greater")
18 | var resolution: int = 16:
19 | set(value):
20 | resolution = value
21 | _properties_changed()
22 |
23 | @export_range(0.1, 10.0, 0.1, "or_greater")
24 | var amplitude: float = 1.0:
25 | set(value):
26 | amplitude = value
27 | _properties_changed()
28 |
29 | @export
30 | var noise_seed: int = 0:
31 | set(value):
32 | noise_seed = value
33 | _properties_changed()
34 |
35 | @export
36 | var noise_frequency: float = 0.2:
37 | set(value):
38 | noise_frequency = value
39 | _properties_changed()
40 |
41 | func _properties_changed() -> void:
42 | if Engine.is_editor_hint():
43 | _generate()
44 |
45 | func _generate() -> void:
46 | var _collision_shape := get_node_or_null(collision_shape)
47 | if not _collision_shape:
48 | return
49 |
50 | var height_map_shape := _collision_shape.shape as HeightMapShape3D
51 | if height_map_shape == null:
52 | printerr("Collision shape must point to a HeightMapShape3D.")
53 |
54 | var _mesh_instance := get_node_or_null(mesh_instance)
55 | if not _mesh_instance:
56 | return
57 |
58 | var array_mesh := _mesh_instance.mesh as ArrayMesh
59 | if array_mesh == null:
60 | printerr("Mesh instance must point to an ArrayMesh.")
61 |
62 | var noise_gen := FastNoiseLite.new()
63 | noise_gen.seed = noise_seed
64 | noise_gen.frequency = noise_frequency
65 | noise_gen.noise_type = FastNoiseLite.TYPE_PERLIN
66 | noise_gen.fractal_type = FastNoiseLite.FRACTAL_NONE
67 |
68 | var heights := PackedFloat32Array()
69 | heights.resize(resolution * resolution)
70 |
71 | for z in range(resolution):
72 | for x in range(resolution):
73 | heights[z * resolution + x] = noise_gen.get_noise_2d(x, z)
74 |
75 | var min_height := +INF
76 | var max_height := -INF
77 |
78 | for height in heights:
79 | min_height = min(min_height, height)
80 | max_height = max(max_height, height)
81 |
82 | var size := (resolution - 1) as float
83 | var extent := size / 2.0
84 |
85 | for z in range(resolution):
86 | for x in range(resolution):
87 | var i := z * resolution + x
88 | var fy := remap(heights[i], min_height, max_height, 0, 1)
89 | var fx := 1.0 - absf(remap(x / size, 0, 1, -1, 1))
90 | var fz := 1.0 - absf(remap(z / size, 0, 1, -1, 1))
91 | heights[i] = fy * fx * fz * amplitude
92 |
93 | height_map_shape.map_width = resolution
94 | height_map_shape.map_depth = resolution
95 | height_map_shape.map_data = heights
96 |
97 | var plane_mesh := PlaneMesh.new()
98 | plane_mesh.size = Vector2i(size as int, size as int)
99 | plane_mesh.subdivide_width = resolution - 2
100 | plane_mesh.subdivide_depth = resolution - 2
101 |
102 | var mesh_arrays := plane_mesh.get_mesh_arrays()
103 | var plane_vertices := mesh_arrays[Mesh.ARRAY_VERTEX] as PackedVector3Array
104 | var plane_indices := mesh_arrays[Mesh.ARRAY_INDEX] as PackedInt32Array
105 | var vertex_count := plane_indices.size()
106 |
107 | var vertices := PackedVector3Array()
108 | vertices.resize(vertex_count)
109 |
110 | for n in range(vertex_count):
111 | var i := plane_indices[n]
112 | var v := plane_vertices[i]
113 | var ix := roundi(v.x + extent)
114 | var iz := roundi(v.z + extent)
115 | var vy := heights[iz * resolution + ix]
116 | vertices[n] = Vector3(v.x, vy, v.z)
117 |
118 | var normals := PackedVector3Array()
119 | normals.resize(vertex_count)
120 |
121 | for n in range(0, vertex_count, 3):
122 | var v0 := vertices[n + 0]
123 | var v1 := vertices[n + 1]
124 | var v2 := vertices[n + 2]
125 |
126 | var v0_to_v1 := (v1 - v0).normalized()
127 | var v0_to_v2 := (v2 - v0).normalized()
128 | var normal := v0_to_v2.cross(v0_to_v1)
129 |
130 | normals[n + 0] = normal
131 | normals[n + 1] = normal
132 | normals[n + 2] = normal
133 |
134 | array_mesh.clear_surfaces()
135 |
136 | mesh_arrays.clear()
137 | mesh_arrays.resize(Mesh.ARRAY_MAX)
138 | mesh_arrays[Mesh.ARRAY_VERTEX] = vertices
139 | mesh_arrays[Mesh.ARRAY_NORMAL] = normals
140 | array_mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, mesh_arrays)
141 |
--------------------------------------------------------------------------------
/Godot_Project/examples/shapes/entities/separation_rays/separation_rays.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=3 format=3 uid="uid://dyveo1c8dyfqp"]
2 |
3 | [ext_resource type="Material" uid="uid://ctm5wb05otmn4" path="res://examples/common/materials/green.tres" id="1_2mywa"]
4 |
5 | [sub_resource type="SeparationRayShape3D" id="SeparationRayShape3D_y3thr"]
6 | length = 0.5
7 | slide_on_slope = true
8 |
9 | [node name="SeparationRays" type="RigidBody3D"]
10 |
11 | [node name="Shape_Back" type="CollisionShape3D" parent="."]
12 | shape = SubResource("SeparationRayShape3D_y3thr")
13 |
14 | [node name="Mesh" type="CSGCylinder3D" parent="Shape_Back"]
15 | transform = Transform3D(1, 0, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0.25)
16 | radius = 0.05
17 | height = 0.5
18 | material = ExtResource("1_2mywa")
19 |
20 | [node name="Shape_Right" type="CollisionShape3D" parent="."]
21 | transform = Transform3D(0, 0, 1, 0, 1, 0, -1, 0, 0, 0, 0, 0)
22 | shape = SubResource("SeparationRayShape3D_y3thr")
23 |
24 | [node name="Mesh" type="CSGCylinder3D" parent="Shape_Right"]
25 | transform = Transform3D(1, 0, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0.25)
26 | radius = 0.05
27 | height = 0.5
28 | material = ExtResource("1_2mywa")
29 |
30 | [node name="Shape_Front" type="CollisionShape3D" parent="."]
31 | transform = Transform3D(-1, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0)
32 | shape = SubResource("SeparationRayShape3D_y3thr")
33 |
34 | [node name="Mesh" type="CSGCylinder3D" parent="Shape_Front"]
35 | transform = Transform3D(1, 0, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0.25)
36 | radius = 0.05
37 | height = 0.5
38 | material = ExtResource("1_2mywa")
39 |
40 | [node name="Shape_Left" type="CollisionShape3D" parent="."]
41 | transform = Transform3D(0, 0, -1, 0, 1, 0, 1, 0, 0, 0, 0, 0)
42 | shape = SubResource("SeparationRayShape3D_y3thr")
43 |
44 | [node name="Mesh" type="CSGCylinder3D" parent="Shape_Left"]
45 | transform = Transform3D(1, 0, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0.25)
46 | radius = 0.05
47 | height = 0.5
48 | material = ExtResource("1_2mywa")
49 |
50 | [node name="Shape_Up" type="CollisionShape3D" parent="."]
51 | transform = Transform3D(1, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0)
52 | shape = SubResource("SeparationRayShape3D_y3thr")
53 |
54 | [node name="Mesh" type="CSGCylinder3D" parent="Shape_Up"]
55 | transform = Transform3D(1, 0, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0.25)
56 | radius = 0.05
57 | height = 0.5
58 | material = ExtResource("1_2mywa")
59 |
60 | [node name="Shape_Down" type="CollisionShape3D" parent="."]
61 | transform = Transform3D(1, 0, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0)
62 | shape = SubResource("SeparationRayShape3D_y3thr")
63 |
64 | [node name="Mesh" type="CSGCylinder3D" parent="Shape_Down"]
65 | transform = Transform3D(1, 0, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0.25)
66 | radius = 0.05
67 | height = 0.5
68 | material = ExtResource("1_2mywa")
69 |
--------------------------------------------------------------------------------
/Godot_Project/examples/shapes/entities/sphere/sphere.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=3 format=3 uid="uid://h15mak3p16ck"]
2 |
3 | [ext_resource type="Material" uid="uid://ctm5wb05otmn4" path="res://examples/common/materials/green.tres" id="1_pbysg"]
4 |
5 | [sub_resource type="SphereShape3D" id="SphereShape3D_s1iwo"]
6 |
7 | [node name="Sphere" type="RigidBody3D"]
8 |
9 | [node name="Shape" type="CollisionShape3D" parent="."]
10 | shape = SubResource("SphereShape3D_s1iwo")
11 |
12 | [node name="Mesh" type="CSGSphere3D" parent="."]
13 | radial_segments = 36
14 | rings = 18
15 | material = ExtResource("1_pbysg")
16 |
--------------------------------------------------------------------------------
/Godot_Project/examples/shapes/shapes.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=17 format=3 uid="uid://bua2ujukcadgw"]
2 |
3 | [ext_resource type="Environment" uid="uid://cgl5t5rlv6o6v" path="res://examples/common/environments/default.tres" id="1_3khfi"]
4 | [ext_resource type="Script" path="res://examples/common/scripts/free_look_camera.gd" id="1_uh1hw"]
5 | [ext_resource type="PackedScene" uid="uid://h15mak3p16ck" path="res://examples/shapes/entities/sphere/sphere.tscn" id="3_4mmy4"]
6 | [ext_resource type="PackedScene" uid="uid://dyveo1c8dyfqp" path="res://examples/shapes/entities/separation_rays/separation_rays.tscn" id="3_rnu5g"]
7 | [ext_resource type="PackedScene" uid="uid://bdo18a3tpxda1" path="res://examples/shapes/entities/box/box.tscn" id="4_tqif0"]
8 | [ext_resource type="PackedScene" uid="uid://cxj20ksax0cnv" path="res://examples/shapes/entities/capsule/capsule.tscn" id="5_h3oln"]
9 | [ext_resource type="PackedScene" uid="uid://dufmnyw4ry3c3" path="res://examples/shapes/entities/cylinder/cylinder.tscn" id="6_tlkvd"]
10 | [ext_resource type="PackedScene" uid="uid://cqqkfrnystsat" path="res://examples/shapes/entities/convex_polygon/convex_polygon.tscn" id="7_objwy"]
11 | [ext_resource type="PackedScene" uid="uid://cco8tutfmoey8" path="res://examples/shapes/entities/height_map/height_map.tscn" id="8_8j6mc"]
12 | [ext_resource type="PackedScene" uid="uid://dosgsvakfplrm" path="res://examples/shapes/entities/concave_polygon/concave_polygon.tscn" id="9_i15bi"]
13 |
14 | [sub_resource type="WorldBoundaryShape3D" id="WorldBoundaryShape3D_714qv"]
15 | plane = Plane(1, 0, 0, 0)
16 |
17 | [sub_resource type="WorldBoundaryShape3D" id="WorldBoundaryShape3D_gcpy5"]
18 | plane = Plane(-1, 0, 0, 0)
19 |
20 | [sub_resource type="WorldBoundaryShape3D" id="WorldBoundaryShape3D_8sn1p"]
21 |
22 | [sub_resource type="WorldBoundaryShape3D" id="WorldBoundaryShape3D_opywq"]
23 | plane = Plane(0, -1, 0, 0)
24 |
25 | [sub_resource type="WorldBoundaryShape3D" id="WorldBoundaryShape3D_l2aow"]
26 | plane = Plane(0, 0, 1, 0)
27 |
28 | [sub_resource type="WorldBoundaryShape3D" id="WorldBoundaryShape3D_54h13"]
29 | plane = Plane(0, 0, -1, 0)
30 |
31 | [node name="Shapes" type="Node3D"]
32 |
33 | [node name="Environment" type="WorldEnvironment" parent="."]
34 | environment = ExtResource("1_3khfi")
35 |
36 | [node name="Sun" type="DirectionalLight3D" parent="."]
37 | transform = Transform3D(-0.825549, -0.544985, 0.146493, 0, 0.259587, 0.965719, -0.56433, 0.797249, -0.214302, 0, 0, 0)
38 | light_bake_mode = 0
39 | shadow_enabled = true
40 |
41 | [node name="Camera" type="Camera3D" parent="."]
42 | transform = Transform3D(-0.707107, -0.353553, 0.612372, 0, 0.866026, 0.5, -0.707107, 0.353553, -0.612372, 8, 10, -8)
43 | current = true
44 | script = ExtResource("1_uh1hw")
45 |
46 | [node name="DebugGeometry" type="JoltDebugGeometry3D" parent="."]
47 | visible = false
48 |
49 | [node name="SeparationRays" parent="." instance=ExtResource("3_rnu5g")]
50 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 12.5, 0)
51 |
52 | [node name="Sphere" parent="." instance=ExtResource("3_4mmy4")]
53 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 11, 0)
54 |
55 | [node name="Box" parent="." instance=ExtResource("4_tqif0")]
56 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 9.5, 0)
57 |
58 | [node name="Capsule" parent="." instance=ExtResource("5_h3oln")]
59 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 7.5, 0)
60 |
61 | [node name="Cylinder" parent="." instance=ExtResource("6_tlkvd")]
62 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 5.5, 0)
63 |
64 | [node name="ConvexPolygon" parent="." instance=ExtResource("7_objwy")]
65 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 4, 0)
66 |
67 | [node name="HeightMap" parent="." instance=ExtResource("8_8j6mc")]
68 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0)
69 |
70 | [node name="ConcavePolygon" parent="." instance=ExtResource("9_i15bi")]
71 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
72 |
73 | [node name="WorldBoundaries" type="StaticBody3D" parent="."]
74 |
75 | [node name="Left" type="CollisionShape3D" parent="WorldBoundaries"]
76 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -20, 0, 0)
77 | shape = SubResource("WorldBoundaryShape3D_714qv")
78 |
79 | [node name="Right" type="CollisionShape3D" parent="WorldBoundaries"]
80 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 20, 0, 0)
81 | shape = SubResource("WorldBoundaryShape3D_gcpy5")
82 |
83 | [node name="Bottom" type="CollisionShape3D" parent="WorldBoundaries"]
84 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -20, 0)
85 | shape = SubResource("WorldBoundaryShape3D_8sn1p")
86 |
87 | [node name="Top" type="CollisionShape3D" parent="WorldBoundaries"]
88 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 20, 0)
89 | shape = SubResource("WorldBoundaryShape3D_opywq")
90 |
91 | [node name="Front" type="CollisionShape3D" parent="WorldBoundaries"]
92 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -20)
93 | shape = SubResource("WorldBoundaryShape3D_l2aow")
94 |
95 | [node name="Back" type="CollisionShape3D" parent="WorldBoundaries"]
96 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 20)
97 | shape = SubResource("WorldBoundaryShape3D_54h13")
98 |
--------------------------------------------------------------------------------
/Godot_Project/tests/camera_rotation/camera_rotation_example.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=16 format=3 uid="uid://bwxt880aodsau"]
2 |
3 | [ext_resource type="Script" path="res://tests/camera_rotation/test_camera_rotation.gd" id="1_qkm28"]
4 | [ext_resource type="PackedScene" uid="uid://biunegs8tkvn0" path="res://addons/godot_vision/VisionVolumeCamera.tscn" id="1_voaop"]
5 | [ext_resource type="Texture2D" uid="uid://bmd0x5t1c2b3i" path="res://examples/hello/textures/checker.jpg" id="3_rolhg"]
6 |
7 | [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_c0ixi"]
8 | albedo_color = Color(0, 0, 1, 1)
9 |
10 | [sub_resource type="BoxMesh" id="BoxMesh_5m4tc"]
11 | material = SubResource("StandardMaterial3D_c0ixi")
12 | size = Vector3(1, 1, 0.1)
13 |
14 | [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_g8kml"]
15 | albedo_color = Color(1, 0.0431373, 0.0235294, 1)
16 |
17 | [sub_resource type="BoxMesh" id="BoxMesh_s4ay3"]
18 | material = SubResource("StandardMaterial3D_g8kml")
19 | size = Vector3(1, 1, 0.1)
20 |
21 | [sub_resource type="PrismMesh" id="PrismMesh_ap0fu"]
22 | material = SubResource("StandardMaterial3D_g8kml")
23 | size = Vector3(1, 0.5, 0.1)
24 |
25 | [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_45vx0"]
26 | albedo_color = Color(0, 1, 0, 1)
27 |
28 | [sub_resource type="BoxMesh" id="BoxMesh_xtsrd"]
29 | material = SubResource("StandardMaterial3D_45vx0")
30 | size = Vector3(1, 1, 0.1)
31 |
32 | [sub_resource type="PrismMesh" id="PrismMesh_ndxyc"]
33 | material = SubResource("StandardMaterial3D_45vx0")
34 | size = Vector3(1, 0.5, 0.1)
35 |
36 | [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_cgugi"]
37 |
38 | [sub_resource type="BoxMesh" id="BoxMesh_cmp3s"]
39 | material = SubResource("StandardMaterial3D_cgugi")
40 | size = Vector3(0.34, 0.34, 0.34)
41 |
42 | [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_nyu35"]
43 | albedo_texture = ExtResource("3_rolhg")
44 | uv1_scale = Vector3(3, 3, 3)
45 | uv1_offset = Vector3(2.08165e-12, 2.08165e-12, 2.08165e-12)
46 |
47 | [sub_resource type="BoxMesh" id="BoxMesh_f6g3q"]
48 | material = SubResource("StandardMaterial3D_nyu35")
49 | size = Vector3(3, 0.05, 3)
50 |
51 | [node name="CameraRotationExample" type="Node3D"]
52 | script = ExtResource("1_qkm28")
53 |
54 | [node name="Object" type="Node3D" parent="."]
55 |
56 | [node name="MeshInstance3D" type="MeshInstance3D" parent="Object"]
57 | transform = Transform3D(1, 0, 0, 0, 0.969967, 0, 0, 0, 1, 0, 0, 0)
58 | mesh = SubResource("BoxMesh_5m4tc")
59 | skeleton = NodePath("../..")
60 |
61 | [node name="MeshInstance3D2" type="MeshInstance3D" parent="Object"]
62 | transform = Transform3D(-4.37114e-08, 3.48787e-16, 1, 3.48787e-16, 1, -3.48787e-16, -1, 3.48787e-16, -4.37114e-08, 0, 0, 0)
63 | mesh = SubResource("BoxMesh_s4ay3")
64 | skeleton = NodePath("../..")
65 |
66 | [node name="MeshInstance3D5" type="MeshInstance3D" parent="Object"]
67 | transform = Transform3D(-4.37114e-08, 3.48787e-16, 1, 3.48787e-16, 1, -3.48787e-16, -1, 3.48787e-16, -4.37114e-08, 0, 0.747964, 0)
68 | mesh = SubResource("PrismMesh_ap0fu")
69 | skeleton = NodePath("../..")
70 |
71 | [node name="MeshInstance3D3" type="MeshInstance3D" parent="Object"]
72 | transform = Transform3D(-2.30028e-08, 0.99555, -4.42442e-08, -8.02307e-24, -4.35169e-08, -1.01219, -0.526243, -4.35169e-08, 1.93398e-15, 0, 0, 0)
73 | mesh = SubResource("BoxMesh_xtsrd")
74 | skeleton = NodePath("../..")
75 |
76 | [node name="MeshInstance3D4" type="MeshInstance3D" parent="Object"]
77 | transform = Transform3D(-2.30028e-08, 0.99555, -4.42442e-08, -8.02307e-24, -4.35169e-08, -1.01219, -0.526243, -4.35169e-08, 1.93398e-15, 0.75, 2.08165e-12, 2.08165e-12)
78 | mesh = SubResource("PrismMesh_ndxyc")
79 | skeleton = NodePath("../..")
80 |
81 | [node name="VisionVolumeCamera" parent="." instance=ExtResource("1_voaop")]
82 |
83 | [node name="reference_mesh" type="MeshInstance3D" parent="VisionVolumeCamera"]
84 | mesh = SubResource("BoxMesh_cmp3s")
85 |
86 | [node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
87 | transform = Transform3D(0.760995, 0.293167, -0.57874, 1.86432e-16, 0.892074, 0.45189, 0.648758, -0.343886, 0.678864, 0, 0, 0)
88 |
89 | [node name="Floor" type="MeshInstance3D" parent="."]
90 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.08165e-12, -0.5, 2.08165e-12)
91 | mesh = SubResource("BoxMesh_f6g3q")
92 |
--------------------------------------------------------------------------------
/Godot_Project/tests/camera_rotation/test_camera_rotation.gd:
--------------------------------------------------------------------------------
1 | extends Node3D
2 |
3 | @onready var cam_node: Node3D = $VisionVolumeCamera
4 |
5 | const pos_changes := [Vector3(0, 0, 1), Vector3(1, 0, 0), Vector3(0, 0, -1), Vector3(-1, 0, 0)]
6 |
7 | func _ready():
8 | var rot: Vector3 = Vector3(0, 0, 0)
9 | var pos: Vector3 = Vector3(0, 0, 0)
10 | var pos_change_index := 0
11 |
12 | await timeout(1)
13 | while true:
14 | await tween_prop(cam_node, "scale", Vector3(1, 1, 1) * 0.3, 0.5)
15 | await timeout(0.6)
16 | await tween_prop(cam_node, "scale", Vector3(1, 1, 1) * 1.0, 0.5)
17 | await timeout(0.6)
18 |
19 | rot += Vector3(0, 0.5 * PI, 0)
20 | pos += pos_changes[pos_change_index] * 4
21 | pos_change_index = (pos_change_index + 1) % pos_changes.size()
22 |
23 | await tween_prop(cam_node, "rotation", rot, 0.53)
24 | await timeout(0.53)
25 | await tween_prop(cam_node, "position", pos, 0.53)
26 | await timeout(0.53)
27 |
28 | func timeout(amt: float):
29 | await get_tree().create_timer(amt).timeout
30 |
31 | func tween_prop(node: Node3D, prop_name: String, value, duration: float):
32 | await create_tween().\
33 | tween_property(node, prop_name, value, duration)\
34 | .set_ease(Tween.EASE_IN_OUT)\
35 | .set_trans(Tween.TRANS_CUBIC)\
36 | .finished
37 |
--------------------------------------------------------------------------------
/Godot_Project/tests/csg_polygon_test.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=4 format=3 uid="uid://tmu3qtedjbbw"]
2 |
3 | [ext_resource type="Texture2D" uid="uid://bmd0x5t1c2b3i" path="res://examples/hello/textures/checker.jpg" id="1_2m6p3"]
4 | [ext_resource type="PackedScene" uid="uid://biunegs8tkvn0" path="res://addons/godot_vision/VisionVolumeCamera.tscn" id="2_x6x3v"]
5 |
6 | [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_qi11a"]
7 | albedo_texture = ExtResource("1_2m6p3")
8 |
9 | [node name="Node3D" type="Node3D"]
10 |
11 | [node name="VisionVolumeCamera" parent="." instance=ExtResource("2_x6x3v")]
12 |
13 | [node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
14 | transform = Transform3D(0.633948, 0.376368, -0.675616, 2.43785e-17, 0.873594, 0.486656, 0.773376, -0.308514, 0.553813, 0, 0, 0)
15 |
16 | [node name="Scene" type="Node3D" parent="."]
17 | transform = Transform3D(3, 0, 0, 0, 3, 0, 0, 0, 3, 0, -1.24146, 0)
18 |
19 | [node name="CSGPolygon3D" type="CSGPolygon3D" parent="Scene"]
20 | transform = Transform3D(1, -6.97574e-16, -1.5246e-23, -1.5246e-23, -4.37114e-08, 1, -6.97574e-16, -1, -4.37114e-08, 0, 0, 0)
21 | polygon = PackedVector2Array(-1.61006, -0.885131, -0.642553, 0.927015, 0.892323, 0.936577, 1.02559, -0.656505, -0.24, -1.98)
22 | depth = 0.23
23 | material = SubResource("StandardMaterial3D_qi11a")
24 |
25 | [node name="CSGBox3D" type="CSGBox3D" parent="Scene/CSGPolygon3D"]
26 | transform = Transform3D(0.857984, -0.513676, -2.24535e-08, 0.513676, 0.857984, -6.20771e-09, 2.24535e-08, -6.20771e-09, 1, -0.80101, 1.27625, -0.328236)
27 | operation = 2
28 | size = Vector3(1, 1, 1.96436)
29 |
--------------------------------------------------------------------------------
/Godot_Project/tests/drag/drag_example.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=7 format=3 uid="uid://nnhkfeyaceaf"]
2 |
3 | [ext_resource type="PackedScene" uid="uid://biunegs8tkvn0" path="res://addons/godot_vision/VisionVolumeCamera.tscn" id="1_h4nnu"]
4 | [ext_resource type="Script" path="res://examples/common/scripts/draggable.gd" id="2_rnoc5"]
5 |
6 | [sub_resource type="BoxShape3D" id="BoxShape3D_5oa15"]
7 | size = Vector3(1.5, 1, 1)
8 |
9 | [sub_resource type="BoxMesh" id="BoxMesh_rfpgq"]
10 | size = Vector3(1.5, 1, 1)
11 |
12 | [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_0aq11"]
13 | albedo_color = Color(0.803922, 0, 0.803922, 1)
14 |
15 | [sub_resource type="TextMesh" id="TextMesh_yuig5"]
16 | material = SubResource("StandardMaterial3D_0aq11")
17 | text = "Drag Me"
18 |
19 | [node name="Drag Test" type="Node3D"]
20 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0050149, -0.00658166, 0.00135791)
21 |
22 | [node name="VisionVolumeCamera" parent="." instance=ExtResource("1_h4nnu")]
23 |
24 | [node name="MeshInstance3D" type="MeshInstance3D" parent="VisionVolumeCamera"]
25 |
26 | [node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
27 | transform = Transform3D(0.688506, 0.382906, -0.615907, -4.30062e-16, 0.849257, 0.527979, 0.72523, -0.363517, 0.584719, 0, 0, 0)
28 |
29 | [node name="Drag Me Button" type="StaticBody3D" parent="."]
30 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.08165e-12, 2.08165e-12, 2.08165e-12)
31 | collision_mask = 0
32 | script = ExtResource("2_rnoc5")
33 |
34 | [node name="CollisionShape3D" type="CollisionShape3D" parent="Drag Me Button"]
35 | shape = SubResource("BoxShape3D_5oa15")
36 |
37 | [node name="MeshInstance3D" type="MeshInstance3D" parent="Drag Me Button"]
38 | mesh = SubResource("BoxMesh_rfpgq")
39 |
40 | [node name="Label" type="MeshInstance3D" parent="Drag Me Button"]
41 | transform = Transform3D(1.97583, 0, 0, 0, 1.97583, 0, 0, 0, 1.97583, 0, 0, 0.603814)
42 | mesh = SubResource("TextMesh_yuig5")
43 |
44 | [connection signal="input_event" from="Drag Me Button" to="Drag Me Button" method="_on_input_event"]
45 |
--------------------------------------------------------------------------------
/Godot_Project/tests/materials/materials.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=6 format=3 uid="uid://dk45ipd2q36d4"]
2 |
3 | [ext_resource type="PackedScene" uid="uid://biunegs8tkvn0" path="res://addons/godot_vision/VisionVolumeCamera.tscn" id="1_g8bpa"]
4 | [ext_resource type="Texture2D" uid="uid://bmd0x5t1c2b3i" path="res://examples/hello/textures/checker.jpg" id="2_2tb3w"]
5 |
6 | [sub_resource type="SphereMesh" id="SphereMesh_2wcns"]
7 |
8 | [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_8nf6y"]
9 | albedo_color = Color(0, 0, 1, 1)
10 | emission_enabled = true
11 | emission_texture = ExtResource("2_2tb3w")
12 |
13 | [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_pudax"]
14 | albedo_color = Color(0, 0, 1, 1)
15 |
16 | [node name="Materials" type="Node2D"]
17 |
18 | [node name="VisionVolumeCamera" parent="." instance=ExtResource("1_g8bpa")]
19 |
20 | [node name="MeshInstance3D" type="MeshInstance3D" parent="."]
21 | mesh = SubResource("SphereMesh_2wcns")
22 | surface_material_override/0 = SubResource("StandardMaterial3D_8nf6y")
23 |
24 | [node name="MeshInstance3D2" type="MeshInstance3D" parent="."]
25 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.37252, 0, 0)
26 | mesh = SubResource("SphereMesh_2wcns")
27 | surface_material_override/0 = SubResource("StandardMaterial3D_pudax")
28 |
--------------------------------------------------------------------------------
/Godot_Project/tests/physics_soft_body/example_physics_soft_body.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=6 format=3 uid="uid://dsy1vwxw22fuo"]
2 |
3 | [ext_resource type="PackedScene" uid="uid://biunegs8tkvn0" path="res://addons/godot_vision/VisionVolumeCamera.tscn" id="1_sipvq"]
4 |
5 | [sub_resource type="TorusMesh" id="TorusMesh_ugvrj"]
6 |
7 | [sub_resource type="BoxShape3D" id="BoxShape3D_ai6d5"]
8 | size = Vector3(5, 0.5, 5)
9 |
10 | [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_3uh6x"]
11 | albedo_color = Color(0.560452, 0, 0.00512891, 1)
12 |
13 | [sub_resource type="BoxMesh" id="BoxMesh_ycqr2"]
14 | material = SubResource("StandardMaterial3D_3uh6x")
15 | size = Vector3(5, 0.5, 5)
16 |
17 | [node name="ExamplePhysicsSoftBody" type="Node3D"]
18 |
19 | [node name="VisionVolumeCamera" parent="." instance=ExtResource("1_sipvq")]
20 |
21 | [node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
22 | transform = Transform3D(0.760995, 0.293167, -0.57874, 1.86432e-16, 0.892074, 0.45189, 0.648758, -0.343886, 0.678864, 0, 0, 0)
23 |
24 | [node name="SoftBody3D" type="SoftBody3D" parent="."]
25 | transform = Transform3D(0.747218, 0.393794, -0.535342, 0, 0.805535, 0.592548, 0.664578, -0.442762, 0.601911, 0.00134921, 0, 0.00252247)
26 | mesh = SubResource("TorusMesh_ugvrj")
27 | simulation_precision = 10
28 | linear_stiffness = 0.67
29 | pressure_coefficient = 1500.0
30 |
31 | [node name="RigidBody3D" type="RigidBody3D" parent="."]
32 | transform = Transform3D(0.999952, 0.0098435, 0, -0.0098435, 0.999952, 0, 0, 0, 1, 0, -1.60509, 0)
33 | input_ray_pickable = false
34 | mass = 1000.0
35 | freeze = true
36 |
37 | [node name="CollisionShape3D" type="CollisionShape3D" parent="RigidBody3D"]
38 | shape = SubResource("BoxShape3D_ai6d5")
39 |
40 | [node name="MeshInstance3D" type="MeshInstance3D" parent="RigidBody3D"]
41 | mesh = SubResource("BoxMesh_ycqr2")
42 | skeleton = NodePath("../..")
43 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2024 Kevin Watters and Adam Watters
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # GodotVisionExample
2 |
3 | An example project for [GodotVision](https://github.com/kevinw/GodotVision).
4 |
5 |
6 |
7 | 
8 |
9 | This Xcode example project specifies GodotVision as a package dependency, and has an example Godot project in `Godot_Project`.
10 |
11 |
12 | ### Questions? Join the [GodotVision Discord](https://discord.gg/XvB4dwGUtF)
13 |
14 |
15 | ## To Run
16 |
17 | - Get the newest Xcode (15.2).
18 | - Install the visionOS SDK when it asks you which platforms you'd like to deploy to.
19 | - Clone this repository.
20 | - **❗❗ VERY IMPORTANT ❗❗** Open `Godot_Project/project.godot` in Godot. (This is so that Godot's asset importers run.)
21 | - Back in Xcode, set the target next to the play button to be Apple Vision Pro simulator.
22 | - Hit play. You'll get an error that you need to "Trust and Enable" the macros in [SwiftGodot](https://github.com/migueldeicaza/SwiftGodot) and [SwiftGodotKit](https://github.com/migueldeicaza/SwiftGodotKit). You may need to click the build error in the issues tab to enable them.
23 | - Hit play again. The first build will be slow, since we need to compile SwiftGodot, which includes Swift bindings for all of Godot's gdextension API. Subsequent builds will be faster!
24 |
25 | ## To Hack on GodotVision
26 |
27 | GodotVision is referenced as a Package Dependency in this example repo. If you want to modify GodotVision:
28 |
29 | * Clone the [GodotVision](https://github.com/kevinw/GodotVision) repository next to your project.
30 | * Drag the GodotVision folder onto your Xcode project's navigator/file tree on the left. This establishes a local package dependency and changes to GodotVision you make will have immediate effect in your project.
31 |
--------------------------------------------------------------------------------
/docs/screenshot1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kevinw/GodotVisionExample/a4d8ef822b7dccffb3e85dc71dde6ac7fa4617d1/docs/screenshot1.jpg
--------------------------------------------------------------------------------
/scripts/copy_bundle_resources:
--------------------------------------------------------------------------------
1 | #!/bin/bash -e
2 |
3 | # TODO: this script could be invoked by an Xcode "Run Script" Build Phase to copy only the imported resources we need in the built product. Currently we just copy over everything.
4 |
5 | #
6 | # use rsync to copy over .godot directory
7 | #
8 |
9 | DEST="${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Godot_Project"
10 |
11 | mkdir -p "$DEST"
12 | rsync -avhmW \
13 | --exclude=.DS_Store \
14 | --exclude=.godot/shader_cache \
15 | --exclude=.godot/editor \
16 | --exclude=.godot/exported \
17 | --delete \
18 | --delete-excluded \
19 | "${SRCROOT}/Godot_Project/.godot" \
20 | "$DEST"
21 |
22 | #
23 | # use find to find files which don't have a sibling .import file; copy those
24 | #
25 |
26 | # Accumulate files in an array
27 | files=()
28 | pushd "$SRCROOT"
29 | while IFS= read -r -d $'\0' file; do
30 | if [[ "${file%.import}" = "$file" && ! -e "${file}.import" ]] || [[ "${file%.import}" != "$file" ]]; then
31 | files+=("$file")
32 | fi
33 | done < <(find Godot_Project ! -path '*/.godot/*' ! -path '*/.gitignore' ! -path '*/.DS_Store' -type fl -print0)
34 |
35 | # Process each file in the array (e.g., copying them)
36 | for file in "${files[@]}"; do
37 | DESTFILE=$DEST/${file#Godot_Project/}
38 | mkdir -p -- $(dirname -- "$DESTFILE")
39 | cp -p "$file" "$DESTFILE"
40 | done
41 |
--------------------------------------------------------------------------------