I want to attach my truck to a trailer ,I don’t know how ,I tried with sockets but it does not work. How cand I do ?
This video is a bit long, but pretty much does exactly what you want. http://youtu.be/VVPSTDiDlOA
I try and it works ! thank you very much ! It is one problem ,when I pres H it hitch a little far . How I can adjust distance between trailer and truck ?
Here is what I did.
This is all in my player BP. ‘MyCar’ is actually the trailer which is a car my player can posses, but also pull around because my player is a wheeled robot.
What it is OnComponentBeginOverlap event ? it’s a custom event ? how I do that ?
In your Truck Blueprint, go to the viewport, add a box trigger, put the box trigger where your hitch is, click on the box trigger and look in the details panel, go down to the bottom, click ‘+’ next to ‘On Component Begin Overlap’, and that will add the event to your event graph, it will fire every something is overlapping that box, and in your case, you want to detect what it is overlapping, the hitch point on your trailer, so that only when they are overlapping can you hitch up. The ‘Cast to’ after the event is to check what is overlapping, so you would drag off the overlap node and type ‘Cast To’ and look for your trailer blueprint, then plug in the other actor into the ‘object’ pin of the cast, and so if the cast worked it will fire the next event, which in my example is the branch to check if the hitch component of the trailer is being overlapped and not just the trailer itself, and if the overlapping component is the trailer hitch, then set ‘CanHitch’ to true, same thing with the OnComponentEndOverlap event, to set the ‘CanHitch’ to false.
Thank you very much !