I made a knockback system using launch character and it still buggy when the player hit on the corner of the collision it will launch sideways and not straight. How to make it launch straight when it hit on the corner side?
Try a vector from the actor to the player.
Yes, although you can just use GetActorLocation ( for the self ), and GetActorLocation for the player
It still error
For something like this, you may need to vector a bit more to make things consistent, try this:
- [edit] - added projection to ensure things always stay put
This cares only about the directions, ignoring orientation of the entities involved. In hindsight, this should be finding rotation of the projected vector, tbh. And that should be it, really.
I already follow your nodes but somehow it still error and can it changed from static mesh to box collision?
It’s easier with box overlap as you do not need to account for multiple hits:
If you want to eliminate Z and rely on angle only, add Project Vector on to Plane node between Get Unit Direction and Rotate Vector Around Axis. Although Z can be removed in many ways. We know so little about what you’re doing - this is pretty scenario agnostic, so to speak.
Perhaps rather than saying ‘still error’ you could describe what is not working and include a screenshot of how you’ve wired it up. The link you provided is protected.
This is a great thread. I am excited for the completion of this project.
Fixed the link
The knockback doesn’t launch the character forward like you did
Can we see the script? How am I supposed to guess how you wired it? Nodes for quick copy/paste:
What’s the value of knockback?
1000
Ha, I can’t spot the difference. Not sure. Added a debug arrow to visualise…
…and see what’s going on. Seems to behave OK:
Zipped project, see if you can compare, perhaps you can find the difference:
What if you make the collision bigger?
What if you make the collision bigger? You can see my boxes in the vid.
Sorry i want to record the gameplay but the video is blank
I’m no longer sure how you want it to work. The size of the box does not matter for as long as the character can trigger the overlap - which will happen at the very edge when the character’s capsule intersects with the box collision boundary.
Consider running the project I linked to see if it behaves the way you envisioned it to. Is what I presented even close to what you’re trying to achieve?
Did you add the debug arrow? It often helps.