|Topic was automatically imported from the old Question2Answer platform.
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?
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 ?
Inces | 2022-04-30 09:36
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.
SweetPie | 2022-04-30 10:09
please share print screen of example segments. Using something that will not block images
Inces | 2022-04-30 15:39
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.
godot_dev_ | 2022-06-22 19:04