Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to teleport Vehicle Player Pawn?

I tried using the Get Player Pawn > Teleport (binded to a key event). The Vehicle didn't want to teleport to the designated location. It pretty much do nothing. Is there anything special needed for telporting Vehicle Pawn? I believe this action works in 4.1 on standard FPS pawn.

Thanks in advance.

Product Version: Not Selected
more ▼

asked Jul 13 '14 at 08:21 AM in Blueprint Scripting

avatar image

88 9 12 18

avatar image DJMidKnight Jul 13 '14 at 05:56 PM

Can you show a screenshot of how you have your blueprint hooked up?

avatar image RinDreamX Jul 14 '14 at 05:25 AM

alt text

I've placed this in the Vehicle Pawn that I use as a default pawn in game info. I've also tried this same exact function in Level Blueprint and it didn't do anything. I've verified the input ResetCar was executing using Print String.

telport.jpg (32.9 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

4 answers: sort voted first

Hi there,

I ran into the same issue and the basics of the issue is that the physics body on the skeletal mesh needs to be teleported along with the actor itself.

I am not sure if you are just using blueprints or also are adding c++. We use c++ and wrote a teleport function to our vehicle which does the following:

Calls StopMovementImmediately on the movement component
Then calls Mesh->SetAllPhysicsPosition(GetActorLocation());
Finally calls Mesh->SetAllPhysicsRotation(GetActorRotation());

If you are using blueprints only I dont see anywhere this stuff is accessible. If you do have any C++ I recommend you either add a new blueprint function which does the same on your vehicle c++ class OR add a static function to your blueprint library c++ class.

Alternatively you could continue to use the teleport blueprint function on your actor, and in your c++ dervied vehicle class override virtual void TeleportSucceeded(bool bIsATest) (from AActor) and call the three functions listed above.

The real function which does the actual teleport is void FBodyInstance::SetBodyTransform(const FTransform& NewTransform, bool bTeleport). As long as your provide true to the second param, the body is then teleported without physics.

Hope this helps

more ▼

answered Jul 23 '14 at 11:52 PM

avatar image

496 18 27 142

avatar image RinDreamX Jul 24 '14 at 05:25 PM

Unfortunately I don't have good knowledge on doing things in C++ :( Somehow I still can't believe I can't achieve the same thing in BP. I'm trying to understand your function here. (Since obviously mine didn't work lOl)

Calls StopMovementImmediately on the movement component In BP: I did found the function of Vehicle Movement > StopMovementImmediately.

Then calls Mesh->SetAllPhysicsPosition(GetActorLocation()); In BP: I found the function for the Mesh to Set new Location.

Finally calls Mesh->SetAllPhysicsRotation(GetActorRotation()); In BP: I found the function for the Mesh to Set new Rotation. alt text

But I don't exactly understand in what causes the vehicle to teleport in your next description.

Greatly appreciate the help. Shamelessly requesting more info XD

snipimage.jpg (57.9 kB)
avatar image Ben.Driehuis Jul 24 '14 at 11:57 PM

No worries at all :)

Yeah Stop movement immediately is available via blueprints. The other two however are not, which is where your issue will be.

I assume the skeletal mesh you have has a physics body setup. This is how our is. Setting the position of the mesh doesnt actually move that physics body, which is what is doing all the real work.

What you need to do is tell the physics body that it too has to move. And from what I can see, there is no way to do this in blueprints without writing some c++ code.

Do you have your project setup for c++ at all? If you do, the easiest thing to do to see if this fixes your case, is to create your own Blueprint function library class and add a function which will teleport the physics of a skeletal mesh component. This should also move the actor. It does the way we have it setup. .

avatar image Ben.Driehuis Jul 24 '14 at 11:57 PM

Had to split this, since it was too long.. Here is the code:

Make a header file called MyNewBPFunctionLibrary.h:

 #pragma once
 #include "MyNewBPFunctionLibrary.generated.h"
 class UMyNewBPFunctionLibrary : public UBlueprintFunctionLibrary
     UFUNCTION(BlueprintCallable, Category = "MyNewFunctions")
     static void TeleportPhysicsBody(USkeletalMeshComponent* Mesh, const FVector& NewLocation, const FRotator& NewRotation);

And in your cpp file (MyNewBPFunctionLibrary.cpp). Note whatever you call your game, thats what YourGameModule should be.

 #include "YourGameModule.h"
 #include "MyNewFunctionLibrary.h"
 UMyNewFunctionLibrary::UMyNewFunctionLibrary(const class FPostConstructInitializeProperties& PCIP)
     : Super(PCIP)
 void UMyNewFunctionLibrary::TeleportPhysicsBody(USkeletalMeshComponent* Mesh, const FVector& NewLocation, const FRotator& NewRotation)
avatar image RinDreamX Jul 25 '14 at 06:59 AM

My project is blueprint base and yes I use PhAT in the mesh component. I have no idea how to do stuff in Unreal4 w/ C++ :(

I'll try to do some learning on how to use the code you paste above. Thanks again for explaining it and giving me the C++ blueprint node.

avatar image Ben.Driehuis Jul 25 '14 at 07:05 AM

No worries at all, if you give it a go and run into issue let me know and ill try and sort you out. Good luck!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

I have been having a very similar issue with something I have been working. I have found somewhat of a workaround, however this only works server-side so far, and not for clients. I'll put it simply.

Disable physics > Delay > Teleport > Delay > Enable physics

I have found that this does work for my vehicle pawn, however it only works for the server. Clients seem to jump to the destination, then back to where they were. I'm still working on it, but it should be enough to get the ball rolling.

more ▼

answered Sep 20 '14 at 10:47 AM

avatar image

83 3 6 10

avatar image Spit_Fyre633 Sep 20 '14 at 12:54 PM

alt text Sorry, only have paint to work in at the moment to get a picture for you.

Also, using 4.4.3 - Don't think this should have any affect though.

bp_teleport.png (168.5 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

I tried this and notice it worked fine unless you are doing multiplayer screens or running the play option with dedicated server in which case I think it needs some replication.

If you are wanting to make this work in multiplayer just create a CustomEvent and under replication make it Run On Server and check Reliable(which gives it a high priority). Drag off the Keybind and then type in the name of your custom event which should create a blue version of it.

alt text Then add your custom event and connect it to teleport. I would change the Get Player Index to Get Reference to Self so that you don't teleport other players around.

example.png (99.0 kB)
more ▼

answered Jul 14 '14 at 03:44 PM

avatar image

1.2k 50 24 51

avatar image RinDreamX Jul 14 '14 at 05:27 PM

I will try this later today when I get home. I don't remember setting a multiplayer game though. I'm using the vehicle template from 4.2 is there anything special about that template that automatically set it as a multiplayer? (will investigate things myself too later).

Thanks again for the reply, I'll let you know the result.

avatar image RinDreamX Jul 14 '14 at 08:27 PM

It didn't work :( I made a new clean UE4.2 Vehicle template and tried the above teleport method, it still didn't work. I might migrate my Vehicle to my FPS project and see whether the teleport function work or not later on. Any other ideas? Thanks for the reply btw.

avatar image Wobbleyheadedbob Jul 15 '14 at 12:05 PM

I suspect the vehicle blueprint in the demo has been built for multiplayer. I'm no expert but if UE4 is at all like Unity in a multiplayer environment, i.e. where dedicated server is ticked or you have multiple clients in the simulation then movement on the player pawns is restricted to being simulated on the server (to prevent clients cheating). I could be wrong though.

avatar image RinDreamX Jul 15 '14 at 05:26 PM

I've tested my Vehicle Pawn on an empty FPS template project and it still won't teleport. But FPS Character teleport just fine. So it's definitely something with the vehicle pawn that doesn't allow it to teleport.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

alt text

Ok I gave up on teleporting my car using teleport / set location function. It's completely non working for vehicle pawn. So I decided to just destroy the actor and reposses it. This doesn't solve the fundamental problems, but at least gets me to where I want for now. I really hope somebody knows the answer on why I can't use standard teleport for vehicle pawn. I've double checked the teleport and confirmed it that on the same project with a regular character pawn teleport worked.

capture.jpg (90.7 kB)
more ▼

answered Jul 15 '14 at 06:19 AM

avatar image

88 9 12 18

avatar image RinDreamX Jul 20 '14 at 04:54 AM

Anybody have the real solution for teleporting Vehicle pawn? Please.... The destroy actor temporary solution break some attributes that I've set on the previous pawn and I don't want to keep hacking things because of not knowing how to teleport my vehicle pawn properly :(

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question