Why dose only the bottom of my trace capsule work?
It works perfectly fine, so long as the bottom of the capsule overlaps a floor, but if only the side or top overlaps, it doesn't work. Why not? (Or if you know any other way to find a floor within a capsule radius, please let me know.)
asked Mar 15 '17 at 12:14 PM in Blueprint Scripting
I didn't perfectly get what you meant but maybe it's hitting something other than the floor. If you want to find the floor, I would do one of two things: use a sphere tracer, similar to yours but simpler, better and bug proof, mostly, because it will find first whats in the center, because of the shape of the sphere. If you want something very simple just use very simple just use a line trace, most of the times you will get the same thing is a sphere in this case, but I aways prefer to use a Box tracer, as it'll get what's closest to you, as it's square, just need to remember to set the rotation right :)
For example, on my game/project I have a series of animations, when you jump or start falling, it'll trace the floor (from the pelvis, you can also offset the starting point so you are sure it wont hit anything else), if the distance is higher than say 500, it will do a animation and when it gets to say 150 it will trigger the getting ready to land animation, if the distance is bigger than 1500 the character will get scared and trigger another animation.
Hope this helps, if you need anything else just ask please, also please send a feedback, is the writing good? Anything :)
answered Mar 15 '17 at 12:51 PM
Hey, awesome, spent the last month creating multiple ledge tracing :)
I made like 5 different ones, i was even thinking on creating a thread to share my results. Let me break it down for you:
--- The most simple way of doing this (very simple) is by having a tick line tracer pointed down, get your player position, add forward vector multiplied by some number to position it at the ideal distance you want and add a number of your like to the Z axys, probably 200, then. You might want to use the original Z location for the end (you dont want the trace to go all the way to the floor). If it finds anything, Now we are going to do a wall line traced (Use branch so it only does it when it finds the top of the ledge). Get the location (subtract a bit from the Z axys (10 is enough)) and set as End. For the starting point use your player location. Or instead you can use just a box/sphere trace and not subtract from the end (use the same Z location). Some adjustments might be needed to get the perfect grabing location (you can offset your player when grabing/hanging). Pros - Very simple to do and cost effective Cons - Might not be as precise and if there is another object on top o the one you want, it WILL be blocked
Now the one I use :)
That`s a much more advanced way to do it:
--- I have an array of multiple forwarded pointed line tracers, they will offset down. For each of them that find the wall, i`ll then make a down pointed line trace, if it finds lots of ledges on the way, i`ll show all the options i have. Then i have a function that calculate the closest to a location i set (I`m getting my player location and offsetting it UP) after the function I limit it to a certain vector length from my head, if it`s close enough I can grab it. Right now im using two of those, one for each hand (because I`m creating a very advanced system, controlled by hands and driven by IK and moving, not using animations, it can adjust itself for various offsets and rotations)
Pros- very precise and adaptative, it can find the smallest grabing holes. Cons - heavy (haven`t checked how much, but certainly more)
Sorry i dont have pictures from my blueprint, i`m not home. Do you think I should post a thread so I can help more people on that?
Hopefully this will help you :D, have an awesome day. You can ask me anything you feel like asking.
answered Mar 17 '17 at 12:53 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here