Announcement

Collapse
No announcement yet.

Spawn to actor Location

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Spawn to actor Location

    Hi all...
    I spawn an actor to my current actor location. All works apart if i spawn watching to my left, the actor spawn far. If i watch to the rght, the actor spawn correctly, if i watch at my left the actor spawn far... why?

    #2
    I assume you want to spawn something ahead of the actor?

    You do this by using GetActorLocation + ( GetForwardVector x float Offset ). The Offset is the distance in centimeters ahead.

    No need to break the vector return value from either GetActorLocation or GetForwardVector since you will need all 3 axes.

    GetForwardVector is a 3d direction Vector and since you only use the X axis you get a 1d direction magnitude along only the x axis.
    Last edited by GarnerP57; 03-26-2018, 08:11 PM.

    Comment


      #3
      Excuse me, but i m using x, y and z, so it's like i m using a vector. Can you show me a BP please?

      Comment


        #4
        I still can't spawn it corretly... how i m suppose to do?

        Comment


          #5
          Click image for larger version

Name:	Offset.PNG
Views:	61
Size:	49.7 KB
ID:	1451534

          This should do the trick.

          Comment


            #6
            Offset is the distance in cm of what?

            Comment


              #7
              Yes how far ahead in cm. of the actor you want the location to be.

              Comment


                #8
                i want that the actor spawn in the same place of my previous actor... With this method, with no moltiplication, my actor still spawn every time in the same direction, no matter if i m watching at right or left
                Last edited by Siengried; 03-29-2018, 10:13 AM.

                Comment


                  #9
                  Then just use GetActorLocation

                  Comment


                    #10
                    Same problem. He will spawn every time in the right direction even if i m watching at my left

                    Comment


                      #11
                      As I can see in Siengriedblueprint he did not use get actor transform and the spawn actor orientation is set to 0,0,0 (default value) so it will always face at 0,0,0 orientation you need to use get actor transform and split struct pin to get the actor orientation so if you look at a direction X you are supposed to spawn the actor at the last known orientation. I don't know if I understand correctly your issue. It might be an issue with you get forward vector returning you the wrong value check if the actor spawn always like 90 degree of where you looking at if so try (rotate vector around axis) and connect the in vector to your (get forward vector) angle degree at 90 and axis to a (get up vector)...
                      Last edited by brahoule; 03-29-2018, 07:04 PM.

                      Comment


                        #12
                        You right, thanks. I solved

                        Comment

                        Working...
                        X