0 votes

Hello!

I'm trying to generate a random 3d dungeon build out of rooms.

My room is spatial node, with a floor and 4 walls made of CSGBox instances, and a Door CSGBox with subtraction to make a basic hole in the wall.

Basic structure:
Spatial:

  • CSGBox Floor
  • Spatial Walls

    • CSGBox Walls 1-4

I'm making a script to dynamically generate rooms, and when I add another room to the scene at runtime, I fall through the floor.

Example Code:

var roompath = "res://Rooms/Room 3.tscn"
var room
scene = load(roompath)
var room
instance = room_scene.instance()
// Move the instance around to connect it to another room

Is there something I need to call to enable collision for my dynamically created room instance?

in Engine by (16 points)

1 Answer

0 votes

Whoops! Turns out I was adding my room as a child of a "Node" type. If I put it under a spatial, it works just fine!

by (16 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.