mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-06 07:50:22 +01:00
Update impact, rigid groundcheck, moving platform (#634)
This commit is contained in:
committed by
GitHub
parent
a4e8231f5a
commit
57f8628b50
@@ -10,6 +10,13 @@ const OPTION_FRICTION = "Physics options/Friction (Rigid only)"
|
||||
const OPTION_ROUGH = "Physics options/Rough (Rigid only)"
|
||||
const OPTION_PROCESS_PHYSICS = "Physics options/AnimationPlayer physics process mode"
|
||||
|
||||
const SHAPE_CAPSULE = "Collision shapes/Capsule"
|
||||
const SHAPE_BOX = "Collision shapes/Box"
|
||||
const SHAPE_CYLINDER = "Collision shapes/Cylinder"
|
||||
const SHAPE_SPHERE = "Collision shapes/Sphere"
|
||||
const SHAPE_CONVEX = "Collision shapes/Convex"
|
||||
const SHAPE_RAY = "Collision shapes/Ray"
|
||||
|
||||
var _gravity = false
|
||||
var _slope = false
|
||||
var _snap = false
|
||||
@@ -24,6 +31,9 @@ var _current_body_key = ""
|
||||
var _current_body = null
|
||||
var _body_type = ["KinematicBody", "RigidBody"]
|
||||
|
||||
var _shapes = {}
|
||||
var _current_shape = ""
|
||||
|
||||
|
||||
func _ready():
|
||||
var options = $Options
|
||||
@@ -36,6 +46,13 @@ func _ready():
|
||||
_body_scene[option_name] = get_packed_scene(body)
|
||||
body.queue_free()
|
||||
|
||||
options.add_menu_item(SHAPE_CAPSULE)
|
||||
options.add_menu_item(SHAPE_BOX)
|
||||
options.add_menu_item(SHAPE_CYLINDER)
|
||||
options.add_menu_item(SHAPE_SPHERE)
|
||||
options.add_menu_item(SHAPE_CONVEX)
|
||||
options.add_menu_item(SHAPE_RAY)
|
||||
|
||||
options.add_menu_item(OPTION_GRAVITY, true, false)
|
||||
options.add_menu_item(OPTION_SLOPE, true, false)
|
||||
options.add_menu_item(OPTION_SNAP, true, false)
|
||||
@@ -46,6 +63,14 @@ func _ready():
|
||||
options.connect("option_selected", self, "_on_option_selected")
|
||||
options.connect("option_changed", self, "_on_option_changed")
|
||||
|
||||
_shapes[SHAPE_CAPSULE] = "Capsule"
|
||||
_shapes[SHAPE_BOX] = "Box"
|
||||
_shapes[SHAPE_CYLINDER] = "Cylinder"
|
||||
_shapes[SHAPE_SPHERE] = "Sphere"
|
||||
_shapes[SHAPE_CONVEX] = "Convex"
|
||||
_shapes[SHAPE_RAY] = "Ray"
|
||||
_current_shape = _shapes[SHAPE_CAPSULE]
|
||||
|
||||
spawn_body_index(_current_body_index)
|
||||
|
||||
|
||||
@@ -60,6 +85,26 @@ func _input(event):
|
||||
func _on_option_selected(option):
|
||||
if _body_scene.has(option):
|
||||
spawn_body_key(option)
|
||||
else:
|
||||
match option:
|
||||
SHAPE_CAPSULE:
|
||||
_current_shape = _shapes[SHAPE_CAPSULE]
|
||||
spawn_body_index(_current_body_index)
|
||||
SHAPE_BOX:
|
||||
_current_shape = _shapes[SHAPE_BOX]
|
||||
spawn_body_index(_current_body_index)
|
||||
SHAPE_CYLINDER:
|
||||
_current_shape = _shapes[SHAPE_CYLINDER]
|
||||
spawn_body_index(_current_body_index)
|
||||
SHAPE_SPHERE:
|
||||
_current_shape = _shapes[SHAPE_SPHERE]
|
||||
spawn_body_index(_current_body_index)
|
||||
SHAPE_CONVEX:
|
||||
_current_shape = _shapes[SHAPE_CONVEX]
|
||||
spawn_body_index(_current_body_index)
|
||||
SHAPE_RAY:
|
||||
_current_shape = _shapes[SHAPE_RAY]
|
||||
spawn_body_index(_current_body_index)
|
||||
|
||||
|
||||
func _on_option_changed(option, checked):
|
||||
@@ -91,9 +136,10 @@ func spawn_body_index(body_index):
|
||||
_current_body_key = _key_list[body_index]
|
||||
var body_parent = $Bodies
|
||||
var body = _body_scene[_key_list[body_index]].instance()
|
||||
body_parent.add_child(body)
|
||||
_current_body = body
|
||||
init_body()
|
||||
body_parent.add_child(body)
|
||||
start_test()
|
||||
|
||||
|
||||
func spawn_body_key(body_key):
|
||||
@@ -103,9 +149,10 @@ func spawn_body_key(body_key):
|
||||
_current_body_index = _key_list.find(body_key)
|
||||
var body_parent = $Bodies
|
||||
var body = _body_scene[body_key].instance()
|
||||
body_parent.add_child(body)
|
||||
_current_body = body
|
||||
init_body()
|
||||
body_parent.add_child(body)
|
||||
start_test()
|
||||
|
||||
|
||||
func init_body():
|
||||
@@ -116,7 +163,13 @@ func init_body():
|
||||
elif _current_body is RigidBody:
|
||||
_current_body.physics_material_override.rough = _rough
|
||||
_current_body.physics_material_override.friction = 1.0 if _friction else 0.0
|
||||
for shape in _current_body.get_children():
|
||||
if shape is CollisionShape:
|
||||
if shape.name != _current_shape:
|
||||
shape.queue_free()
|
||||
|
||||
|
||||
func start_test():
|
||||
var animation_player = $Platforms/KinematicPlatform/AnimationPlayer
|
||||
animation_player.stop()
|
||||
if _animation_physics:
|
||||
@@ -125,11 +178,10 @@ func init_body():
|
||||
animation_player.playback_process_mode = AnimationPlayer.ANIMATION_PROCESS_IDLE
|
||||
animation_player.play("Move")
|
||||
|
||||
$LabelBodyType.text = "Body Type: " + _body_type[_current_body_index]
|
||||
$LabelBodyType.text = "Body Type: " + _body_type[_current_body_index] + " \nCollision Shape: " + _current_shape
|
||||
|
||||
|
||||
func get_packed_scene(node):
|
||||
node.owner = self
|
||||
for child in node.get_children():
|
||||
child.owner = node
|
||||
var packed_scene = PackedScene.new()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=9 format=2]
|
||||
[gd_scene load_steps=14 format=2]
|
||||
|
||||
[ext_resource path="res://utils/camera_orbit.gd" type="Script" id=1]
|
||||
[ext_resource path="res://tests/functional/test_moving_platform.gd" type="Script" id=2]
|
||||
@@ -8,13 +8,29 @@
|
||||
[sub_resource type="CapsuleShape" id=1]
|
||||
radius = 0.3
|
||||
|
||||
[sub_resource type="PhysicsMaterial" id=2]
|
||||
[sub_resource type="BoxShape" id=2]
|
||||
extents = Vector3( 0.3, 0.8, 0.3 )
|
||||
|
||||
[sub_resource type="BoxShape" id=3]
|
||||
[sub_resource type="CylinderShape" id=3]
|
||||
radius = 0.3
|
||||
height = 1.60005
|
||||
|
||||
[sub_resource type="SphereShape" id=4]
|
||||
radius = 0.79945
|
||||
|
||||
[sub_resource type="ConvexPolygonShape" id=5]
|
||||
points = PoolVector3Array( -0.7, 0, -0.7, -0.3, 0, 0.8, 0.8, 0, -0.3, 0, -0.8, 0 )
|
||||
|
||||
[sub_resource type="RayShape" id=6]
|
||||
length = 0.8
|
||||
|
||||
[sub_resource type="PhysicsMaterial" id=7]
|
||||
|
||||
[sub_resource type="BoxShape" id=8]
|
||||
extents = Vector3( 2, 0.2, 1 )
|
||||
|
||||
[sub_resource type="Animation" id=4]
|
||||
length = 4.0
|
||||
[sub_resource type="Animation" id=9]
|
||||
length = 9.0
|
||||
tracks/0/type = "bezier"
|
||||
tracks/0/path = NodePath(".:translation:x")
|
||||
tracks/0/interp = 1
|
||||
@@ -22,8 +38,18 @@ tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"points": PoolRealArray( -7, -0.25, 0, 0.25, 0, -7, -0.25, 0, 0.245766, 0.531658, 6, -0.132614, -0.374802, 0.25, 0 ),
|
||||
"times": PoolRealArray( 0, 0.5, 4 )
|
||||
"points": PoolRealArray( -7, -0.25, 0, 0.25, 0, -7, -0.25, 0, 0.25, 0, 6, -0.25, 0, 0.25, 0 ),
|
||||
"times": PoolRealArray( 0, 3, 6.5 )
|
||||
}
|
||||
tracks/1/type = "bezier"
|
||||
tracks/1/path = NodePath(".:translation:y")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"points": PoolRealArray( -4.23538, -0.25, 0, 0.25, 0, -4.23538, -0.25, 0, 0.25, 0, 3, -0.25, 0, 0.25, 0, 3, -0.25, 0, 0.25, 0, -4.23538, -0.25, 0, 0.25, 0 ),
|
||||
"times": PoolRealArray( 0, 0.5, 3, 6.5, 9 )
|
||||
}
|
||||
|
||||
[node name="Test" type="Spatial"]
|
||||
@@ -40,43 +66,85 @@ __meta__ = {
|
||||
}
|
||||
|
||||
[node name="Options" parent="." instance=ExtResource( 3 )]
|
||||
margin_top = 120.0
|
||||
margin_bottom = 140.0
|
||||
|
||||
[node name="Bodies" type="Spatial" parent="."]
|
||||
|
||||
[node name="KinematicBody" type="KinematicBody" parent="Bodies"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -7, -1.95, 0 )
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -7, -4.18538, 0 )
|
||||
collision_layer = 2
|
||||
script = ExtResource( 4 )
|
||||
_stop_on_slopes = true
|
||||
_use_snap = true
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Bodies/KinematicBody"]
|
||||
[node name="Capsule" type="CollisionShape" parent="Bodies/KinematicBody"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0.8, 0 )
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="Box" type="CollisionShape" parent="Bodies/KinematicBody"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.8, 0 )
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="Cylinder" type="CollisionShape" parent="Bodies/KinematicBody"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.8, 0 )
|
||||
shape = SubResource( 3 )
|
||||
|
||||
[node name="Sphere" type="CollisionShape" parent="Bodies/KinematicBody"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.8, 0 )
|
||||
shape = SubResource( 4 )
|
||||
|
||||
[node name="Convex" type="CollisionShape" parent="Bodies/KinematicBody"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.8, 0 )
|
||||
shape = SubResource( 5 )
|
||||
|
||||
[node name="Ray" type="CollisionShape" parent="Bodies/KinematicBody"]
|
||||
transform = Transform( 1, 0, 0, 0, 0, -1, 0, 1, 0, 0, 0.8, 0 )
|
||||
shape = SubResource( 6 )
|
||||
|
||||
[node name="RigidBody" type="RigidBody" parent="Bodies"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -7, -1.95, 0 )
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -7, -4.18538, 0 )
|
||||
collision_layer = 4
|
||||
physics_material_override = SubResource( 2 )
|
||||
physics_material_override = SubResource( 7 )
|
||||
axis_lock_angular_x = true
|
||||
axis_lock_angular_y = true
|
||||
axis_lock_angular_z = true
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Bodies/RigidBody"]
|
||||
[node name="Capsule" type="CollisionShape" parent="Bodies/RigidBody"]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0.8, 0 )
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="Box" type="CollisionShape" parent="Bodies/RigidBody"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.8, 0 )
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="Cylinder" type="CollisionShape" parent="Bodies/RigidBody"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.8, 0 )
|
||||
shape = SubResource( 3 )
|
||||
|
||||
[node name="Sphere" type="CollisionShape" parent="Bodies/RigidBody"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.8, 0 )
|
||||
shape = SubResource( 4 )
|
||||
|
||||
[node name="Convex" type="CollisionShape" parent="Bodies/RigidBody"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.8, 0 )
|
||||
shape = SubResource( 5 )
|
||||
|
||||
[node name="Ray" type="CollisionShape" parent="Bodies/RigidBody"]
|
||||
transform = Transform( 1, 0, 0, 0, 0, -1, 0, 1, 0, 0, 0.8, 0 )
|
||||
shape = SubResource( 6 )
|
||||
|
||||
[node name="Platforms" type="Spatial" parent="."]
|
||||
|
||||
[node name="KinematicPlatform" type="KinematicBody" parent="Platforms"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -7, -2, 0 )
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -7, -4.25, 0 )
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Platforms/KinematicPlatform"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.2, 0 )
|
||||
shape = SubResource( 3 )
|
||||
shape = SubResource( 8 )
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="Platforms/KinematicPlatform"]
|
||||
anims/Move = SubResource( 4 )
|
||||
anims/Move = SubResource( 9 )
|
||||
|
||||
[node name="Camera" type="Camera" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 10 )
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
extends Test
|
||||
|
||||
|
||||
const OPTION_BIG = "Floor options/Big"
|
||||
const OPTION_SMALL = "Floor options/Small"
|
||||
|
||||
const SHAPE_CONCAVE = "Collision shapes/Concave"
|
||||
const SHAPE_CONVEX = "Collision shapes/Convex"
|
||||
const SHAPE_BOX = "Collision shapes/Box"
|
||||
|
||||
var _dynamic_shapes_scene
|
||||
var _floor_shapes = {}
|
||||
var _floor_size = "Small"
|
||||
|
||||
var _current_floor_name = SHAPE_CONCAVE
|
||||
var _current_bodies
|
||||
var _current_floor
|
||||
|
||||
|
||||
func _ready():
|
||||
var options = $Options
|
||||
_dynamic_shapes_scene = get_packed_scene($DynamicShapes/Bodies)
|
||||
_floor_shapes[SHAPE_CONVEX + "Small"] = get_packed_scene($"Floors/ConvexSmall")
|
||||
_floor_shapes[SHAPE_CONVEX + "Big"] = get_packed_scene($"Floors/ConvexBig")
|
||||
_floor_shapes[SHAPE_CONCAVE + "Big"] = get_packed_scene($"Floors/ConcaveBig")
|
||||
_floor_shapes[SHAPE_CONCAVE + "Small"] = get_packed_scene($"Floors/ConcaveSmall")
|
||||
_floor_shapes[SHAPE_BOX + "Big"] = get_packed_scene($"Floors/BoxBig")
|
||||
_floor_shapes[SHAPE_BOX + "Small"] = get_packed_scene($"Floors/BoxSmall")
|
||||
$DynamicShapes/Bodies.queue_free()
|
||||
for floorNode in $Floors.get_children():
|
||||
floorNode.queue_free()
|
||||
|
||||
options.add_menu_item(OPTION_SMALL)
|
||||
options.add_menu_item(OPTION_BIG)
|
||||
options.add_menu_item(SHAPE_CONCAVE)
|
||||
options.add_menu_item(SHAPE_CONVEX)
|
||||
options.add_menu_item(SHAPE_BOX)
|
||||
|
||||
options.connect("option_selected", self, "_on_option_selected")
|
||||
restart_scene()
|
||||
|
||||
|
||||
func _on_option_selected(option):
|
||||
match option:
|
||||
OPTION_BIG:
|
||||
_floor_size = "Big"
|
||||
OPTION_SMALL:
|
||||
_floor_size = "Small"
|
||||
_:
|
||||
_current_floor_name = option
|
||||
restart_scene()
|
||||
|
||||
|
||||
func restart_scene():
|
||||
if _current_bodies:
|
||||
_current_bodies.queue_free()
|
||||
if _current_floor:
|
||||
_current_floor.queue_free()
|
||||
|
||||
var dynamic_bodies = _dynamic_shapes_scene.instance()
|
||||
_current_bodies = dynamic_bodies
|
||||
add_child(dynamic_bodies)
|
||||
|
||||
var floor_inst = _floor_shapes[_current_floor_name + _floor_size].instance()
|
||||
_current_floor = floor_inst
|
||||
$Floors.add_child(floor_inst)
|
||||
|
||||
$LabelBodyType.text = "Floor Type: " + _current_floor_name.rsplit("/", true, 1)[1] + "\nSize: " + _floor_size
|
||||
|
||||
|
||||
func get_packed_scene(node):
|
||||
for child in node.get_children():
|
||||
child.owner = node
|
||||
for child1 in child.get_children():
|
||||
child1.owner = node
|
||||
for child2 in child1.get_children():
|
||||
child2.owner = node
|
||||
var packed_scene = PackedScene.new()
|
||||
packed_scene.pack(node)
|
||||
return packed_scene
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
[gd_scene load_steps=25 format=2]
|
||||
[gd_scene load_steps=35 format=2]
|
||||
|
||||
[ext_resource path="res://utils/rigidbody_ground_check.gd" type="Script" id=1]
|
||||
[ext_resource path="res://test.gd" type="Script" id=2]
|
||||
[ext_resource path="res://tests/static_scene_plane.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://tests/test_options.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://tests/functional/test_rigidbody_ground_check.gd" type="Script" id=3]
|
||||
[ext_resource path="res://utils/camera_orbit.gd" type="Script" id=4]
|
||||
|
||||
[sub_resource type="PhysicsMaterial" id=1]
|
||||
@@ -62,13 +62,61 @@ friction = 0.0
|
||||
|
||||
[sub_resource type="SpatialMaterial" id=20]
|
||||
|
||||
[sub_resource type="RayShape" id=21]
|
||||
length = 1.5
|
||||
|
||||
[sub_resource type="SphereMesh" id=22]
|
||||
radius = 0.5
|
||||
height = 1.0
|
||||
|
||||
[sub_resource type="PlaneMesh" id=23]
|
||||
size = Vector2( 50, 20 )
|
||||
|
||||
[sub_resource type="ConvexPolygonShape" id=24]
|
||||
points = PoolVector3Array( 25, 0, 10, -25, 0, 10, 25, 0, -10, -25, 0, -10 )
|
||||
|
||||
[sub_resource type="ConvexPolygonShape" id=25]
|
||||
points = PoolVector3Array( 25, 0, 10, -25, 0, 10, 25, 0, -10, -25, 0, -10 )
|
||||
|
||||
[sub_resource type="ConvexPolygonShape" id=26]
|
||||
points = PoolVector3Array( 50, 0, 50, -50, 0, 50, 50, 0, -50, -50, 0, -50 )
|
||||
|
||||
[sub_resource type="ConcavePolygonShape" id=27]
|
||||
data = PoolVector3Array( -1, 0, 1, 1, 0, -1, 1, 0, 1, -1, 0, 1, -1, 0, -1, 1, 0, -1 )
|
||||
|
||||
[sub_resource type="ConcavePolygonShape" id=28]
|
||||
data = PoolVector3Array( 50, 0, 50, -50, 0, 50, 50, 0, -50, -50, 0, 50, -50, 0, -50, 50, 0, -50 )
|
||||
|
||||
[sub_resource type="BoxShape" id=29]
|
||||
extents = Vector3( 50, 1, 20 )
|
||||
|
||||
[sub_resource type="BoxShape" id=30]
|
||||
extents = Vector3( 100, 1, 100 )
|
||||
|
||||
[node name="Test" type="Spatial"]
|
||||
script = ExtResource( 2 )
|
||||
script = ExtResource( 3 )
|
||||
|
||||
[node name="LabelBodyType" type="Label" parent="."]
|
||||
margin_left = 14.0
|
||||
margin_top = 78.0
|
||||
margin_right = 171.0
|
||||
margin_bottom = 92.0
|
||||
text = "Floor Type: "
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Options" parent="." instance=ExtResource( 2 )]
|
||||
margin_top = 120.0
|
||||
margin_bottom = 140.0
|
||||
focus_mode = 2
|
||||
|
||||
[node name="DynamicShapes" type="Spatial" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 9.35591, 0 )
|
||||
|
||||
[node name="RigidBodyBox" type="RigidBody" parent="DynamicShapes"]
|
||||
[node name="Bodies" type="Spatial" parent="DynamicShapes"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 5.2912, 0 )
|
||||
|
||||
[node name="RigidBodyBox" type="RigidBody" parent="DynamicShapes/Bodies"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -6, 0, 0 )
|
||||
physics_material_override = SubResource( 1 )
|
||||
axis_lock_angular_x = true
|
||||
@@ -76,15 +124,15 @@ axis_lock_angular_y = true
|
||||
axis_lock_angular_z = true
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="DynamicShapes/RigidBodyBox"]
|
||||
[node name="CollisionShape" type="CollisionShape" parent="DynamicShapes/Bodies/RigidBodyBox"]
|
||||
transform = Transform( 0.6, 0, 0, 0, 1, 0, 0, 0, 0.6, 0, 0, 0 )
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="DynamicShapes/RigidBodyBox/CollisionShape"]
|
||||
[node name="MeshInstance" type="MeshInstance" parent="DynamicShapes/Bodies/RigidBodyBox/CollisionShape"]
|
||||
mesh = SubResource( 3 )
|
||||
material/0 = SubResource( 4 )
|
||||
|
||||
[node name="RigidBodyCapsule" type="RigidBody" parent="DynamicShapes"]
|
||||
[node name="RigidBodyCapsule" type="RigidBody" parent="DynamicShapes/Bodies"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -3, 0, 0 )
|
||||
physics_material_override = SubResource( 5 )
|
||||
axis_lock_angular_x = true
|
||||
@@ -92,30 +140,30 @@ axis_lock_angular_y = true
|
||||
axis_lock_angular_z = true
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="DynamicShapes/RigidBodyCapsule"]
|
||||
[node name="CollisionShape" type="CollisionShape" parent="DynamicShapes/Bodies/RigidBodyCapsule"]
|
||||
transform = Transform( 0.8, 0, 0, 0, -3.49691e-08, -0.8, 0, 0.8, -3.49691e-08, 0, 0, 0 )
|
||||
shape = SubResource( 6 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="DynamicShapes/RigidBodyCapsule/CollisionShape"]
|
||||
[node name="MeshInstance" type="MeshInstance" parent="DynamicShapes/Bodies/RigidBodyCapsule/CollisionShape"]
|
||||
mesh = SubResource( 7 )
|
||||
material/0 = SubResource( 8 )
|
||||
|
||||
[node name="RigidBodyCylinder" type="RigidBody" parent="DynamicShapes"]
|
||||
[node name="RigidBodyCylinder" type="RigidBody" parent="DynamicShapes/Bodies"]
|
||||
physics_material_override = SubResource( 9 )
|
||||
axis_lock_angular_x = true
|
||||
axis_lock_angular_y = true
|
||||
axis_lock_angular_z = true
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="DynamicShapes/RigidBodyCylinder"]
|
||||
[node name="CollisionShape" type="CollisionShape" parent="DynamicShapes/Bodies/RigidBodyCylinder"]
|
||||
transform = Transform( 0.8, 0, 0, 0, 1, 0, 0, 0, 0.8, 0, 0, 0 )
|
||||
shape = SubResource( 10 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="DynamicShapes/RigidBodyCylinder/CollisionShape"]
|
||||
[node name="MeshInstance" type="MeshInstance" parent="DynamicShapes/Bodies/RigidBodyCylinder/CollisionShape"]
|
||||
mesh = SubResource( 11 )
|
||||
material/0 = SubResource( 12 )
|
||||
|
||||
[node name="RigidBodyConvex" type="RigidBody" parent="DynamicShapes"]
|
||||
[node name="RigidBodyConvex" type="RigidBody" parent="DynamicShapes/Bodies"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 3, 0.974548, 0 )
|
||||
physics_material_override = SubResource( 13 )
|
||||
axis_lock_angular_x = true
|
||||
@@ -123,15 +171,15 @@ axis_lock_angular_y = true
|
||||
axis_lock_angular_z = true
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="DynamicShapes/RigidBodyConvex"]
|
||||
[node name="CollisionShape" type="CollisionShape" parent="DynamicShapes/Bodies/RigidBodyConvex"]
|
||||
transform = Transform( 1.5, 0, 0, 0, 2, 0, 0, 0, 1.5, 0, 0, 0 )
|
||||
shape = SubResource( 14 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="DynamicShapes/RigidBodyConvex/CollisionShape"]
|
||||
[node name="MeshInstance" type="MeshInstance" parent="DynamicShapes/Bodies/RigidBodyConvex/CollisionShape"]
|
||||
mesh = SubResource( 15 )
|
||||
material/0 = SubResource( 16 )
|
||||
|
||||
[node name="RigidBodySphere" type="RigidBody" parent="DynamicShapes"]
|
||||
[node name="RigidBodySphere" type="RigidBody" parent="DynamicShapes/Bodies"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 6, 0, 0 )
|
||||
physics_material_override = SubResource( 17 )
|
||||
axis_lock_angular_x = true
|
||||
@@ -139,21 +187,168 @@ axis_lock_angular_y = true
|
||||
axis_lock_angular_z = true
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="DynamicShapes/RigidBodySphere"]
|
||||
[node name="CollisionShape" type="CollisionShape" parent="DynamicShapes/Bodies/RigidBodySphere"]
|
||||
transform = Transform( 0.8, 0, 0, 0, 0.8, 0, 0, 0, 0.8, 0, 0, 0 )
|
||||
shape = SubResource( 18 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="DynamicShapes/RigidBodySphere/CollisionShape"]
|
||||
[node name="MeshInstance" type="MeshInstance" parent="DynamicShapes/Bodies/RigidBodySphere/CollisionShape"]
|
||||
mesh = SubResource( 19 )
|
||||
material/0 = SubResource( 20 )
|
||||
|
||||
[node name="StaticBodyPlane" parent="." instance=ExtResource( 3 )]
|
||||
[node name="RigidBodyRay" type="RigidBody" parent="DynamicShapes/Bodies"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 8.42391, 0, 0 )
|
||||
physics_material_override = SubResource( 17 )
|
||||
axis_lock_angular_x = true
|
||||
axis_lock_angular_y = true
|
||||
axis_lock_angular_z = true
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="DynamicShapes/Bodies/RigidBodyRay"]
|
||||
transform = Transform( 0.8, 0, 0, 0, 0, -0.8, 0, 0.8, 0, 0, 0, 0 )
|
||||
shape = SubResource( 21 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="DynamicShapes/Bodies/RigidBodyRay/CollisionShape"]
|
||||
mesh = SubResource( 22 )
|
||||
material/0 = SubResource( 20 )
|
||||
|
||||
[node name="Floors" type="Spatial" parent="."]
|
||||
|
||||
[node name="ConvexSmall" type="Spatial" parent="Floors"]
|
||||
|
||||
[node name="ConvexFloor" type="StaticBody" parent="Floors/ConvexSmall"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -10 )
|
||||
collision_layer = 2
|
||||
collision_mask = 3
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="Floors/ConvexSmall/ConvexFloor"]
|
||||
visible = false
|
||||
mesh = SubResource( 23 )
|
||||
material/0 = null
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Floors/ConvexSmall/ConvexFloor"]
|
||||
shape = SubResource( 24 )
|
||||
|
||||
[node name="ConvexFloor2" type="StaticBody" parent="Floors/ConvexSmall"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 10 )
|
||||
collision_layer = 2
|
||||
collision_mask = 3
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="Floors/ConvexSmall/ConvexFloor2"]
|
||||
visible = false
|
||||
mesh = SubResource( 23 )
|
||||
material/0 = null
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Floors/ConvexSmall/ConvexFloor2"]
|
||||
shape = SubResource( 25 )
|
||||
|
||||
[node name="ConvexBig" type="Spatial" parent="Floors"]
|
||||
|
||||
[node name="ConvexFloor" type="StaticBody" parent="Floors/ConvexBig"]
|
||||
collision_layer = 2
|
||||
collision_mask = 3
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="Floors/ConvexBig/ConvexFloor"]
|
||||
visible = false
|
||||
mesh = SubResource( 23 )
|
||||
material/0 = null
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Floors/ConvexBig/ConvexFloor"]
|
||||
shape = SubResource( 26 )
|
||||
|
||||
[node name="ConcaveSmall" type="Spatial" parent="Floors"]
|
||||
|
||||
[node name="ConcaveFloor" type="StaticBody" parent="Floors/ConcaveSmall"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -10 )
|
||||
collision_layer = 2
|
||||
collision_mask = 3
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="Floors/ConcaveSmall/ConcaveFloor"]
|
||||
visible = false
|
||||
mesh = SubResource( 23 )
|
||||
material/0 = null
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Floors/ConcaveSmall/ConcaveFloor"]
|
||||
transform = Transform( 25, 0, 0, 0, 1, 0, 0, 0, 10, 0, 0, 0 )
|
||||
shape = SubResource( 27 )
|
||||
|
||||
[node name="ConcaveFloor2" type="StaticBody" parent="Floors/ConcaveSmall"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 10 )
|
||||
collision_layer = 2
|
||||
collision_mask = 3
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="Floors/ConcaveSmall/ConcaveFloor2"]
|
||||
visible = false
|
||||
mesh = SubResource( 23 )
|
||||
material/0 = null
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Floors/ConcaveSmall/ConcaveFloor2"]
|
||||
transform = Transform( 25, 0, 0, 0, 1, 0, 0, 0, 10, 0, 0, 0 )
|
||||
shape = SubResource( 27 )
|
||||
|
||||
[node name="ConcaveBig" type="Spatial" parent="Floors"]
|
||||
|
||||
[node name="ConcaveFloor" type="StaticBody" parent="Floors/ConcaveBig"]
|
||||
collision_layer = 2
|
||||
collision_mask = 3
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="Floors/ConcaveBig/ConcaveFloor"]
|
||||
visible = false
|
||||
mesh = SubResource( 23 )
|
||||
material/0 = null
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Floors/ConcaveBig/ConcaveFloor"]
|
||||
shape = SubResource( 28 )
|
||||
|
||||
[node name="BoxSmall" type="Spatial" parent="Floors"]
|
||||
|
||||
[node name="BoxFloor" type="StaticBody" parent="Floors/BoxSmall"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -10 )
|
||||
collision_layer = 2
|
||||
collision_mask = 3
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="Floors/BoxSmall/BoxFloor"]
|
||||
visible = false
|
||||
mesh = SubResource( 23 )
|
||||
material/0 = null
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Floors/BoxSmall/BoxFloor"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0 )
|
||||
shape = SubResource( 29 )
|
||||
|
||||
[node name="BoxFloor2" type="StaticBody" parent="Floors/BoxSmall"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 10 )
|
||||
collision_layer = 2
|
||||
collision_mask = 3
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="Floors/BoxSmall/BoxFloor2"]
|
||||
visible = false
|
||||
mesh = SubResource( 23 )
|
||||
material/0 = null
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Floors/BoxSmall/BoxFloor2"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0 )
|
||||
shape = SubResource( 29 )
|
||||
|
||||
[node name="BoxBig" type="Spatial" parent="Floors"]
|
||||
|
||||
[node name="BoxFloor" type="StaticBody" parent="Floors/BoxBig"]
|
||||
collision_layer = 2
|
||||
collision_mask = 3
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="Floors/BoxBig/BoxFloor"]
|
||||
visible = false
|
||||
mesh = SubResource( 23 )
|
||||
material/0 = null
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Floors/BoxBig/BoxFloor"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0 )
|
||||
shape = SubResource( 30 )
|
||||
|
||||
[node name="Camera" type="Camera" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3.604, 22.124 )
|
||||
far = 1000.0
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="OmniLight" type="OmniLight" parent="Camera"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 14.6965, -5.95932 )
|
||||
omni_range = 50.0
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=10 format=2]
|
||||
[gd_scene load_steps=11 format=2]
|
||||
|
||||
[ext_resource path="res://utils/rigidbody_pick.gd" type="Script" id=1]
|
||||
[ext_resource path="res://test.gd" type="Script" id=2]
|
||||
@@ -16,6 +16,8 @@ points = PoolVector3Array( -0.7, 0, -0.7, -0.3, 0, 0.8, 0.8, 0, -0.3, 0, -1, 0 )
|
||||
|
||||
[sub_resource type="SphereShape" id=5]
|
||||
|
||||
[sub_resource type="RayShape" id=6]
|
||||
|
||||
[node name="Test" type="Spatial"]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
@@ -23,7 +25,7 @@ script = ExtResource( 2 )
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 9.35591, 0 )
|
||||
|
||||
[node name="RigidBodyBox" type="RigidBody" parent="DynamicShapes"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -6, 0, 0 )
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -6, 1, 0 )
|
||||
axis_lock_angular_x = true
|
||||
axis_lock_angular_y = true
|
||||
axis_lock_angular_z = true
|
||||
@@ -34,7 +36,7 @@ transform = Transform( 0.6, 0, 0, 0, 1, 0, 0, 0, 0.6, 0, 0, 0 )
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="RigidBodyCapsule" type="RigidBody" parent="DynamicShapes"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -3, 0, 0 )
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -3, 1.0034, 0 )
|
||||
axis_lock_angular_x = true
|
||||
axis_lock_angular_y = true
|
||||
axis_lock_angular_z = true
|
||||
@@ -45,6 +47,7 @@ transform = Transform( 0.8, 0, 0, 0, -3.49691e-08, -0.8, 0, 0.8, -3.49691e-08, 0
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="RigidBodyCylinder" type="RigidBody" parent="DynamicShapes"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.0034, 0 )
|
||||
axis_lock_angular_x = true
|
||||
axis_lock_angular_y = true
|
||||
axis_lock_angular_z = true
|
||||
@@ -55,7 +58,7 @@ transform = Transform( 0.8, 0, 0, 0, 1, 0, 0, 0, 0.8, 0, 0, 0 )
|
||||
shape = SubResource( 3 )
|
||||
|
||||
[node name="RigidBodyConvex" type="RigidBody" parent="DynamicShapes"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 3, 0.974548, 0 )
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 3, 1.97795, 0 )
|
||||
axis_lock_angular_x = true
|
||||
axis_lock_angular_y = true
|
||||
axis_lock_angular_z = true
|
||||
@@ -66,7 +69,7 @@ transform = Transform( 1.5, 0, 0, 0, 2, 0, 0, 0, 1.5, 0, 0, 0 )
|
||||
shape = SubResource( 4 )
|
||||
|
||||
[node name="RigidBodySphere" type="RigidBody" parent="DynamicShapes"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 6, 0, 0 )
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 6, 1, 0 )
|
||||
axis_lock_angular_x = true
|
||||
axis_lock_angular_y = true
|
||||
axis_lock_angular_z = true
|
||||
@@ -76,6 +79,17 @@ script = ExtResource( 1 )
|
||||
transform = Transform( 0.8, 0, 0, 0, 0.8, 0, 0, 0, 0.8, 0, 0, 0 )
|
||||
shape = SubResource( 5 )
|
||||
|
||||
[node name="RigidBodyRay" type="RigidBody" parent="DynamicShapes"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 8, 1, 0 )
|
||||
axis_lock_angular_x = true
|
||||
axis_lock_angular_y = true
|
||||
axis_lock_angular_z = true
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="DynamicShapes/RigidBodyRay"]
|
||||
transform = Transform( 0.8, 0, 0, 0, 0, -0.8, 0, 0.8, 0, 0, 0, 0 )
|
||||
shape = SubResource( 6 )
|
||||
|
||||
[node name="StaticBodyPlane" parent="." instance=ExtResource( 3 )]
|
||||
|
||||
[node name="Camera" type="Camera" parent="."]
|
||||
|
||||
Reference in New Issue
Block a user