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"

How to use transform to spawn actor relative to other actor?

I want to spawn an actor with a position and rotation relative to another actor, and I'm not really sure how to do it properly.

For example say I have actor1 which is a face, and actor2 which is a wooden plank. I want to spawn that wooden plank right in front of the face.

If actor1 was at location (0,0,0) with rotation (0,0,0), I know that I have to spawn my actor2 at (50,0,0) with rotation (0,0,0), to have it appear in front of the face.

Unfortunately the actor1 is no longer at this start location, nor rotation, so how can I spawn actor2 at the right position and rotation? I tried using their transforms, multiplying the actor1 transform with the relative transform (with the translation of (50,0,0) of actor2 but that didn't quite work right...

Anyone can help me out here?

Product Version: UE 4.11
Tags:
more ▼

asked Apr 29 '16 at 11:10 PM in C++ Programming

avatar image

BramV
386 35 36 78

avatar image Outstanding Jul 11 '16 at 04:38 PM

I'm lost in it too T_T if you get the answer to it, please share

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

2 answers: sort voted first

I know I'm late, but anyways!

While spawning an actor, the Transform you specify for its location is at World Space. Your actors need to be attached, in order for the location to be relative. A simple AttachTo should suffice.

On the other hand, if you do NOT want to link the actors in any manner (as should be in this case) you need the actor's World Transform, probably taking it from the root component. Add, then, the location offset and rotate it accordingly (you'll need the "Front" vector of your main actor and rotate that in Z). Then, use that transform to spawn the plank.

more ▼

answered Oct 03 '16 at 03:16 PM

avatar image

† SG †
21 2 7 13

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

To get coordinates that are -175 units from the location of the actor in relative space:

Then you could just feed this value in to the Spawn Actor node.

more ▼

answered Sep 20 '18 at 09:41 PM

avatar image

CoolOppo
6 3 2

(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