#Wall Detection not working

1 messages · Page 1 of 1 (latest)

keen python
#

i cant go right even thought im not at a wall to my right, but i can go left

#

(the axies are normal, i made them myself and they work)

keen python
#

bump

silent wren
#

Not sure yet, but the first thing I noticed is you have 4x FixedUpdate events, that's not necessary at all. In fact you don't want 4, you need to be able to control the order in which these events happen, do it all in a single FixedUpdate

#

Your variable on the left about touching a wall is truncated so I can't see properly if say you have the right or wrong variable referenced in there

#

You also should not get input on FixedUpdate, this will miss input from you on some frames, use Update for Input, and FixedUpdate for physics checks and setting physics

#

The purpose of an axis too is that it can process signed values, negative and positive. You don't need an Axis called Left, or one called Right. The default Horizontal axis should be enough, if it's < 0 it is left, if it's > 0 it's right

#

Add an Update event whose sole job is to set a value called h to Input.GetAxis("Horizontal"), you'll read that value in FixedUpdate

#

That will let you wipe out all of that.

#

The graph is a little too convoluted for me to spend time troubleshooting for you, I recommend simplifying the problem, testing once more, then sharing your progress so we can help you further. I will explain to you some tips for that.

Replace both of these with Custom events, one called CheckLeft, the other called CheckRight, and call them both in sequence from your earlier FixedUpdate

#

How can distance be both < .36 and > .36? I think that could be a mistake

#

Possibly do away with all of this.... and try to simply check if you hit something or not, which you can do by asking the raycast if there is a collider or transform (either will do)

#

Make these changes first, then tell me how your next test goes

#

I'd say a goal would be to get those wall-checks down to a single stream, rather than 2 separate streams, and it's probably easy to do that, but I'll see what you come up with from the above feedback first.

#

also, everyone here is on different timezones, it's less likely that your post is being dismissed, and more likely people are sleeping, working or otherwise busy at the time you posted 😛

#

You should only need these once, just plug the output into both raycast nodes. Simplifying your problem will help a lot.

#

And not necessary but something that will help people review your logic in future, if you use groups like this, we will be able to better see your intentions