Flip over when hitting wall

I am trying to flip over my pawn when I hit the wall…and I think I am Way overthinking it. It sorta works but not really. Help! :slight_smile: I am using a line trace to detect the collision because I don’t want to do it when it hits other things. Still there may be another way to do it.

Also when it flips over I need to move the mouse cursor to the other side or it will just try to flip again.

Can you see your line trace? It looks like your setting your line trace to start and end at itself. What you should do is drag off of the tank get forward vector and multiply that by a float, making that your end location that way he is always line tracing in front of him. Turn your debug line “On for duration” and look at the line trace.

I have an invisible box in front of the tank called “front” that I send the line trace to. I will try the forward vector thing but I do get an accurate line trace currently. I also use the same thing to find which side the tank is facing up or down and thats working ( thats the “beta” and “zero” at the end since I know it has to rotate differently depending on which side its on ).

I just saw that you were using a custom event, where do you call this event? And have you put a print string at the fail side of the line trace, seeing if the line trace is not hitting it?

its front event tick in the event graph. Maybe thats the problem?

Yes, because that is not a event tick, its a custom event, and I also just realized there is nothing Initializing that event so that would never fire. You need to delete and re-add event tick if that’s what you are looking for, and if you already have a tick it has to be off of that one, you can only have 1 tick

Its a custom event fired from Event Tick. By the way if it helps it does fire but usually it will flip about 90 degrees and get stuck . Part of the problem is that I need to move the mouse cursor to the other side once it starts flipping but I don’t know the best way to do that.

What do you mean you need to move the mouse cursor to the other side? Maybe a couple of screenshots showing it flipped with this mouse movement problem?

ok, so I got this right you tank is controlled by pushing a button to go forward and mouse left and right to turn correct? If your mouse location is a problem you will have to manually move it during or after the roll has finished. I believe there is blueprint nodes to do this.

When I go right and hit the wall it starts flipping but my mouse cursor is still on the right. It really needs to move to the left. Otherwise it just tries to flip again because the mouse is on the wrong side.

Yeah W adds force forward towards the mouse position. Ok I will have to try to move the mouse when I get home. Maybe thats my biggest problem

Ok so moving the mouse has helped ALOT ! Now my question is how can I figure out in blueprints which wall direction I am hitting.

If I hit the wall to the right I need to move the mouse 400 units to the left…But How do I figure out if the wall is to the left of me, above me, or below me? I did a print of the mouse position and I can probably do it with some crazy branches… if mouse x > ## and y > ## but is there a better way?

Just have a line trace for each direction to dictate what side you hit

Its not that easy. I don’t mean hit the wall on the right side of my tank I mean hit a wall to the right side of the screen vs one to the left or one at the top of the screen vs bot. The tank is always going to be hitting the wall head on.

Make them different walls you know like. BP_WallLeft, BP_WallRight

Yeah there is no wrong way. You will hear it a lot, I just gave you an option :smiley:

Hmm not a bad idea but I use the same wall names all around. I prefer not to have to worry about changing wall names all the time.

I tried doing a sorta crazy boolean thing but if I change my screen resolution it gets all messed up. I am going to look into using the screen resolution.

lol here is what I came up with to check which wall its hitting. It works at all resolutions. Sometimes the right wall fails so it needs some tweaking. I am SURE there is an easier way to do this :slight_smile: I kind feel like I made one of those machines that takes one hundred steps to toast bread…