I started working on another fake first-person game

It doesn’t fully work yet, because there’s no option for raycasts to only work when the very tip of the ray hits

4 Likes

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.

4 Likes

Ooh that seems like a handy trick. I’m gonna have to use that somewhere.

3 Likes

I’m a vast wealth of information, If you need to know how to do anything I’m always happy to help.

2 Likes

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.

2 Likes

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.

1 Like
  1. 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.
  2. 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.

2 Likes

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

1 Like

the 14 different walls you can possibly see

1 Like

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

1 Like

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.

1 Like

Hmm… actually, I might be able to automate it somehow…

1 Like

I did it, now to redraw all the walls

1 Like

Everything works now, might not be the best solution, but adding more walls isn’t too hard, and it works perfectly

1 Like