x

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"

AnswerHub Maintenance

Background maintenance is scheduled to occur between 9 - 11am EDT on Tuesday, May 21. Site operation may be slower than normal during this time and a brief interruption in operation may be observed

spawning actor behind player position

Hello everyone

I started to learn Blueprint system and find it really great. What i am trying to do now is to place a class (actor) behind player "movement" or at his back. I've already created BluePrint class with sphere object and i can trigger event when "space" is being pressed. Also i got vector of movement of the player , though i have 2 problems i am not sure how to resolve. First i need to place object "behind" player , at his back when he is moving. So i assume this should be like this :

determine vector of movement (x as example)

spawn position = position of player (x - 5 , y , z)

This is simple algorithm though i am not sure how to interpreter it in Blueprint language. The second thing is to detect last vector of movement (when player just stands still) , and class is spawned behind him.

Product Version: Not Selected
Tags:
more ▼

asked Mar 25 '14 at 07:14 PM in Blueprint Scripting

avatar image

oleg.budeanu
67 13 15 16

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

2 answers: sort voted first

Spawn Blueprint

Create a blueprint for the class that you want to spawn, or use an existing one,

and then use the Spawn blueprint node!

if you cant find it, turn context sensitive off

:)

Get Forward Vector

Get the player character unit

Get the player's Forward Vector

Multiply by a NEGATIVE number

 Character's Forward Vector * -256


that will be behind the facing direction of the player character

alt text

Rama

forwardvector.jpg (47.3 kB)
more ▼

answered Mar 25 '14 at 07:37 PM

avatar image

Rama
10.6k 446 343 1085

avatar image oleg.budeanu Mar 25 '14 at 08:35 PM

Thanks for your answer,

How should i spawn a class at that position ((Character's Forward Vector * -256) , Y , Z) I know that there is spawn node , i mean what is the scheme to show that it should spawn at that position exaactly ? Is there a node to join several vectors in lication vector ? I am unsure about this part... Sorry i am really a newbie with this but i learn fast :)

avatar image DizzyWes ♦♦ STAFF Mar 26 '14 at 11:30 AM

Rama is correct, however I would also look at DFT's suggestions below as those are also very relevant!

Great work community, keep it up!

avatar image oleg.budeanu Mar 26 '14 at 11:39 AM

Yes that's actually the answer , thanks for your help guys , and thanks DFT for your hints !

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

Nor as simple as you think :)

This is a very hairy question because one can't just compute what Rama proposed (`spawnPosition = -ForwardVector offset`). That would end up with spawning in a wall, into a prop and so on... any actor relative automatic spawning system must be environment-aware*, and that is not an easy task.

The easiest way to do so is to sphere-cast on the computed spawnPosition from above to determine the ground level at that given point. Here you alse have to make sure that you indeed hit the ground and not something else, so you can use layering or tagging to define and isolate where you can actually spawn your pawn on.

Once you have a clear surface you also need to make sure to have enough space, so I would spawn a collision volume having the very same bounds of the pawn you want to spawn. This has to be there for just 1 frame to detect any overlap and tell you back that an overlap occurred, so that you can look for another spot where to spawn the actor.

more ▼

answered Mar 26 '14 at 12:16 AM

avatar image

Pino of DFT Games
121 1 4 16

(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