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 make CapsuleComponent of Player start movable?

I have a procedurally generated level which is built using many parameters read through a JSON file. Now, I want the player start to be moveable so that I can read the coordinates from the JSON file and spawn the pawn at the given location.

Yes, I know that I could just make the pawn teleport to the location once it has been spawned in the world, but my spawn is somewhat bounded to the Player start. So even if I were to teleport it to the desired location (which I did try), it just comes back to the player start location. any guidance on how to make the player start "movable" would be greatly appreciated. Thank you

Product Version: UE 4.18
more ▼

asked Nov 13 '18 at 07:47 AM in C++ Programming

avatar image

13 1 5

avatar image Brian Johnstone Nov 13 '18 at 06:19 PM

Are you referencing the player start object type that gets placed in the scene? You want to be able to move that so that your actor start can be customized?

avatar image gurankas Nov 14 '18 at 01:06 AM

@Brian Spot on

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

If you create a custom game mode for your level you can override a function called ChoosePlayerStart. This lets you return a specific PlayerStart object to be where you player's actor is spawned. You can keep a reference to a known PlayerStart in your GameMode and when ChoosePlayerStart is called, move that actor to the location you want and then return a reference to it.

more ▼

answered Nov 14 '18 at 02:41 AM

Brian Johnstone (suspended)
avatar image gurankas Nov 14 '18 at 05:32 AM

@Brian The thing is, PlayerStart isn't a movable object. Even if I have a reference and I know the location of where I want to move the actor, I can't move the Player start. Hence, the title of the question.

avatar image Brian Johnstone Nov 14 '18 at 05:47 AM

If you were able to get a reference to your spawned actor and teleport it, what happens if you have no PlayerStart objects in the scene at all? Once teleported the engine wouldn't then try to set your character back to any PlayerStart location.

avatar image gurankas Nov 14 '18 at 07:19 AM

I tried that too. Doesn't work that way. Unfortunately, the only way forward is making the CapsuleComponent "movable"

avatar image Brian Johnstone Nov 14 '18 at 07:13 PM

If you don't place a PlayerStart object in the scene at all what is the behavior? Where does the actor get spawned and what happens if you use SetActorLocation on the spawned actor? Can you try adding a single frame delay and see what happens then?

(comments are locked)
10|2000 characters needed characters left
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