#Uthels Crappy Procedural Dungeon
1 messages Β· Page 1 of 1 (latest)
Having two problems right now - can't get the checkbox I'm using to check if I can build a new room to go to the right spot, and on one of my prefab rooms, the left room spawner works, the right one does not, and I have no idea why, its oriented right as far as I can tell
ah nvm ill just keep pluggin away at it
Name the first problem first.
The first problem, is I am attempting to use Physics.Checkbox to determine if there's a room already in place before I spawn a room, but I think I'm having problems determining the origin placement for it.
if (!Physics.CheckBox(spawnpos.position + (spawnpos.transform.forward * 11), halfextents))
{
randroomid = Random.Range(0, rooms.Length);
newroom = Instantiate(rooms[randroomid], spawnpos.position, spawnpos.rotation);
dungeonController.currentrooms += 1;
}```
11 was the shortest I could make it without it.. triggering on itself
halfextents is 2,2,2
Haven't heard of Checkbox before, let me do a quick research
from what I understand, it's basically the same thing as CheckSphere π
It seems that it's colliding with your checkerboard.
See if ignoring raycast on the board itself might help resolve the first issue.
Or add a filter to omit the board, but do check and see if you are still on the board.
yeah - the first arguement in checkbox designates an origin, so I'm trying to set it to.. some distance in front of the spawn position
well, I think I need the colliders to be able to determine if something is there
Second, does the spawnpos move?
From the spawn pos, you're checking in front of the spawnpos * 11 metric unit.
I see
the rooms are 10x10, so the number I'd assume I'd want to use would be 5, since there's no colliders on the little sphere and cube indicators, and I set a halfextent of 2, which should make a 4x4x4 cube
but anything lower than 11 triggers off itself..
Right...
and 11 doesn't do the trick, I get overlapping rooms occassionally
Are you always checking forward every time?
Will there be any checks on the side of the room?
there's two room prefabs - one with a forward facing outlet, and one with two sideways facing outlets, but they are all oriented appropriately
(since they spawn rooms in the right direction I assume their transform.forward is pointing the right way)
Potentially unrelated but maybe not, on the double outlet room, the left outlet works, the right one does not - no clear reason why π
with transform.forward using a reference to the spawn position transform
Ok so, the left and right have their "own" spawner? script?
make sure that you set to "Local" instead of "World" and see if the gizmo's blue ray is exactly where you want your spawner to check.
yeah, both spawner and script - same script, but using a different transform reference
hmm
Not sure where to find this π
Well in your left/right room, find the gameobject that have the script attached, then take a look at the gizmos when you select the "Move" tool, or press w on your keyboard.
See which way your gizmo is facing.
Also real important, is to make sure you have Local set, not World.
this is what I was missing π
... apparently forward isn't blue, it's the opposite of red?
blue arrow is def not forward anyways..
haha you were right after all - I came to the realization that my rooms weren't oriented back to front, but left to right - all of them, in fact, in the prefabs - the negative red being the direction I wanted to be forwards was the clue
so my solution, since transform.forward wasn't going to work
if (!Physics.CheckBox(spawnpos.position + ((spawnpos.transform.right * -1) * 5), halfextents))
π
and that works π
also solves the right hand room spawner on the two-spawner room not working, for reasons that are now clear
Many thanks mm, problems solves, onwards and upwards!
solved*