It doesn’t fully work yet, because there’s no option for raycasts to only work when the very tip of the ray hits
To make it have so just the tips of the ray casting hit use a second ray cast slightly shorter then the first. Hook both those of those ray casts into a XOR gate and have that turn on what you want. Because the first ray cast is longer it will always turn on first, and when the second one hits it will be the second input to the XOR gate so it will turn off, meaning it only works if the tip of the ray cast hits it. If you have any questions just let me know and I’ll help.
Ooh that seems like a handy trick. I’m gonna have to use that somewhere.
I’m a vast wealth of information, If you need to know how to do anything I’m always happy to help.
The problem is that he’s trying to find a wall behind another wall. Both Raycasts will be registering the same hits and miss, even though you just want to register the tip of the Raycast.
I didn’t look at his code at all so I didn’t know he was looking for a wall behind another wall. He could have a short ray cast go off in front of his character as well as a long one, when the small one hits it will mean that the other ray cast has reached the wall (both of the ray casts need to be in the AND gate input, but this would just mean you can have only the short one, so this is kinda pointless). This only works for one wall, so if he has a different wall with different lengths between the two this won’t work. I’m sure there is a way to get the other wall, I just need to think about it more.
One thing you could try is making 2 blocks for your walls. The longer ray cast looks for the second wall and the other ray cast looks for the first wall. Your walls would need to alternate between the wall types. (using my original reply) I only thought about this for a minute or two, so there may be a flaw.
@JR01 have you done/seen anything similar to this? I have a ton of knowledge of how to use flowlab, but I’ve only tried to make 3 games so far, so I haven’t done a ton of different mechanics. Even if I can figure something out, a more efficient way can probably be given by someone who might have already done it.
- That would probably be the best thing to do, but you probably will hit walls at different angles if your scanning all around the player.
- That would need a Raycast for every wall because that will doesn’t help for hallways.
The only suggestion I have is get an attachment with a Raycast and having the attachment offset to the location you require. I suggest this as well because Raycast Offsets is something that may come to Flowlab in the future.
I already have 14 raycasts for all this, I don’t want to add more
The simplest thing to do would be to create a second block the surrounds the main player and stays a set distance away. Let’s say it’s 15 blocks away so I have a number to work with. A ray cast will extend 7 blocks from the player (can be however small/large you want) If it hits a wall it will go into a AND gate. Then you will have a ray cast extending TOWARDS the player from the second block you made, the distance will be 7 blocks away (can be however small/large you want it as long as there is no overlap). If this ray cast hits a wall it will send a message to the player that will go into the AND gate. When it receives both inputs, you will know there is a wall behind that wall.
Here’s an image to make things simple.
what are the 14 ray casts for? Seeing if there is a wall behind the wall or something else? If it’s something else tell me what it is and I might be able to shorten it down.
I just played your game and it looks really cool, are you using the ray casts to make it automatically generate if there is a wall there so it will put up the 3d version?
Yeah, it sends a 1 or a 0 depending if the ray hits or not
the 14 different walls you can possibly see
Last time I did this, I had an object for each wall you could see, and they would move with the player and check if there were walls
For this game
I’m a lot happier with how this one turned out, but you can’t see as far as I’d like you to be able to see, and for that I’d need to make a lot more objects.
Hmm… actually, I might be able to automate it somehow…
I did it, now to redraw all the walls
Everything works now, might not be the best solution, but adding more walls isn’t too hard, and it works perfectly