So im making a game that has a hobercraft except that the craft has to be magnetised to the track - that is even when the craft is upside down in a loop, it will “stick” to the track.
So anyway, intial attempts were to add force to the static model and set simulate physics to true when the craft got too close to the track and then a force which pulled the craft toward the track when the craft moved too far away. This was done using a line trace and checking the vector length of how far the craft was away from the track. If you use more than one check at different places on the craft and to put force in places other than the center of the craft, you will have physics problems of it flipping over. But there are other issues such as that I need for the craft to rotate based on the slope of the track we are currently hovering over so that if it goes up a hill, the craft will rotate at the same slope as the track.
Turns out that you cant use simulate physics and setactorlocation or setworldlocation at the same time. So I thought about building my own physics and turning off simulate physics and using pure setworldlocationandrotation instead.
So I move my craft forward by using setworldlocation on the static mesh. Not using setactorlocation on the pawn. So the way the craft is setup is the root is a pawn class, under that it has a scene component and under that it has a static mesh component. It really confuses me as to what I should be moving to actually move the craft. If I do setactorlocation on the pawn class, the static mesh stays at the same location but the actors/pawns x,y,z coordinates move forward. If i do setworldlocation on the mesh component, the craft moves forward. I think the pawns x,y,z move too but I havnt checked. So it looks like pawn movement should be done on the static mesh? but this sounds wrong to me. Im using unity before and to move an object, we would always move the root (which in this case is the pawn) and all the children would move with it (which is the scene component and the static mesh) but it appears that to move an actor I need to move the static mesh??? very confusing. What is the correct way here…