I am creating a racing game in the advanced vehicle template. When the car is flipped over on its back, I would like to be able to press the ‘F’ key in-game and have the character flipped 180 degrees so it is upright, and teleport a meter upwards so it drops onto its wheels.
all you need to do is use the set rotation and set location nodes. alternatively you could use the set transform node which is rotation , location, and scale all in one node.
When I tried recreating what you have shown, nothing happened. So I tried referencing the player character when the actor related nodes says “Target = Self”. Still nothing happens and I get error message when exiting the game.
where did you make the script? i am assuming that your making a driving game since you mentioned a car, if thats the case then you would have this script on the car character or the equivalent to what a character would be in that game type (i dont make racing games).
beyond where the script is located you also need to do a bit of debugging since when i tested it it worked and the theory is sound so we need to figure out where your failing. the first step in that process would be to ensure that the input event is happening. to check this just connect a print string just after the event then test in game, if the event is happening then you will see a message from the print string in the upper left of the viewport when you press the F key. if this doesnt happen we know that the actor isnt receiving input.
At first I scripted it in the level blueprint, but just now I have tried it in the character blueprint.
Before there was a problem with referencing the player character in the level blueprint. But now in the character blueprint I am getting the error message:
"Attempting to move a fully simulated skeletal mesh VehicleMesh. Please use the Teleport flag.
Also, I inserted a print string after “F” and it worked, as well as at the end of the scripting, I assume that worked too because it printed “true” in the log in-game
you should just need to check the box where it says teleport. i just made a project with the advanced vehicle and added the below script and it set the car back on its wheels. the script i made was basically the same as the one before but i just used less nodes to accomplish the same thing. i also used the split pin functionality instead of the make and break.