Hello Guys,
I’m trying to get upper left/right & bottom left/right of the player character by player input & my current script only works when the player rotation is forward after player rotates my script not working.
Those two float variables are from actual keyboard/joystick input.
For example when player press W & A on the keyboard I need upper left & when player press S & A on the keyboard I need bottom left and similar for pressing D for the right side.
Edit:
This is an example of the final result with some trace lines, they are created by the user input (In this case only keyboard used so they’re limited to every 45 degrees), but the problem is when character rotates they are not rotating with character & the endpoints are wrong.
I think it would be much easier if you just put 4 ‘scenes’ into the player BP ( it’s just a point in space ). Put them in the right place, then you can always know where these points are just by getting their world position…
It’s not an actor, it’s literally just a point in space. Why bother doing a load of math when you can just put a point somewhere and say ‘that’s the part I mean…’?
Hello, I have completly no idea what your “script” do but from the description I assume you want to rotate with player. So you just need to use GetActorRotation to get your player rotation and rotate vector by it using rotateByAxis node.
Ok, so you float values are either -1 or 1 right? What do you mean by ‘bottom left’? Some vector value? ( I tried your code, it didn’t do much for me… )
Thanks for your messages & time, but I don’t need “getboundingbox”, I just need a new formula to add character rotation to the current script because my script is working when the player has not any rotation at the beginning.
I see your doing a trace from the arrow. I think you need to combine the forward and right vectors from the arrow with your controller input to make the trace end point…