0 votes

I'm trying to make a game where the player goes through spaceships where the interiors are made dynamically, so just hardcoding the interior hitboxes obviously won't work. I think that figuring out where the hallway/room shapes go, then disabling/removing the parts of the ship's hitbox that overlaps the interior shapes would be the easiest solution.

I've thought of having the interior hitboxes be CollisionPolygon2Ds using Segments Build Mode, but then the player wouldn't be able to exit whichever interior shape they are in, since they would collide with the inside of its hitbox.
Another thought I've had, which would be possible to implement, but would be incredibly complicated and buggy, is to generate the interior walls as individual segments, knowing where to start/end using Raycasts. I've tried doing this but I couldn't get it to work.

Has anybody gotten something like this to work?

Godot version 3.4
in Engine by (22 points)

this still sounds overcomplicated. I would be thinking of inverting collisions, like enable movement only when player is within hitbox. That would let You add the shapes together. However I don't know how does your spaceship segment look like ? Is it a tilemap chunk or custom shape ? Does it have more collision shapes than one, indicating walls and doors ?

Thanks for your reply!
I don't think that enabling movement only inside hitboxes will work as I want the player to be a RigidBody2D.
The spaceships are made of custom shapes. There is a main hitbox that collides with other ships, and I think the interior will be made up of several hitboxes.

please share print screen of example segments. Using something that will not block images :)

Instead of disabling part the ship's hitbox, could you not additional collisionboxes of a different type to represent the interior? So whenever the player is colliding with both the ship's hitboxes and this new type of hitbox (let's call it inside-boxes), then your player is inside ship. If the player is only colliding with inside-boxes, clearly they are inside the ship. If they are colliding with the ship hitboxes but not the inside-boxes, then they are outside.

Please log in or register to answer this question.

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.