I’m trying to do a line trace in the direction the character is facing. This works fine as long as the character is facing right but I can’t figure out how to determine that the player has turned and is now facing left in order to invert the line trace.
I tried the forward vector (which gives me a trace to the origin of the world), broke down the transform’s scale to access the y component, tried character rotation… no luck.
Any ideas how I can get the the direction the character is facing?
I finally got it working! I gave my character an additional socket (on the floor between the feet) and used its rotation to find the end point of the trace while the start remained the actor location.
I still feel like this should be possible by just using the pawn’s rotation but at least it’s working now.
Thanks everyone for suggestions! And - awesome work with those additional nodes, they will surely come in handy!
Thanks but with that setup I still get a trace that starts at the character, reaching “into” the world still in view direction of the sidescrolling camera.
I added a little debug printout to see the rotation values and judging by that neither the capsule nor the pawn actually rotate.
The GetWorldLocation doesn’t work with the pawn but there’s not difference in the outcome whether I use the mesh component or the capsule.
I did the line trace in a first person example earlier and it works fine so this almost seems like a bug…?
Yeah you cant select the pawn itself, it thinks its a CapsuleComponent when I try to get self. It must be how the template is written, it doesnt look like its possible to make the mesh the root component and the capsule a child.
I’m using the Print String at the end to see if there’s any difference in the rotation whether my character is facing left or right - but there isn’t.
I’m probably missing something really simple but I just can’t see what…
Still not working, even with your new nodes. The trace when you press K goes from my character to the world origin and the one when you press J goes “into the screen”.
I put my project on the Rocket dropbox (Marquardt/MyProject.zip). If you have the time I’d appreciate it if you (or anyone else) could have a look at it. Starting to feel a bit stupid for not getting this to work
I know this is from a long time ago but whoever gets here and is working with paper2D in 2 dimensions, insted of puting a socket, you can pick the sprite component of the actor and use the “get Socket Transform” function as in this example.
Anyway, much appreciated help, that put me on the correct track.
This is a question from the beta version of the engine. We are marking this answered for tracking purposes. If you are experiencing an issue similar to this please post a new question.