Announcement

Collapse
No announcement yet.

Aligning Actors

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

    Aligning Actors

    How can i align actors when i spawn them flush with the wall, floor, or any sloped surface big enough for it??

    #2
    You want them to align to the closest surface?

    Comment


      #3
      well i have a weapon that will place them, and i want to have to be so close to the wall my crosshair is aiming at to place and it the back would stick to where the crosshair is

      EDIT: Now that i think of it, might be some way to do it like the align to terrain thing =\ Hmm

      Comment


        #4
        Not very hard with a quick trace to get the normal of the wall, and then rotate it to face that direction. If your objects pivot point is set up correctly, the rest is automagic.

        Comment


          #5
          Yeah like bonehead siad, and you just setbase(wall(other)) returned by the trace

          Comment


            #6
            oh, well wat i do exactly in code?

            say Bomb is the actor, and Other is the wall and HitLoc is where the Crosshair is aiming at.

            Comment


              #7
              You need a normal, also. I assume if you have a hitlocation, then you have a hitnormal, right? You simply say Bomb.Rotation = Rotator(hitnormal); which if rot(0,0,0) faces foreward to your mesh (I'm pretty sure that means your mesh faces horizontally to the right), then this will align it with the hit normal (it faces the direction the normal points). Then if your bombs pivot point (the red dot in UED) is aligned to the BACK of the device (the part you want to "stick" to hitlocation) you just Bomb.SetLocation(hitlocation); so it puts the pivot point at that spot. You now have a bomb that is stuck in place, and facing the direction the surface normal faces. If you want it to move with the wall (if the wall can move) then you SetBase(Other); to do that.

              Comment


                #8
                Awsome Thx a bunch, ill get right on it tomorrow, its late now so, we will see! Thx again

                Comment


                  #9
                  Im in school now and i was just wondering, the front of the Mesh faces to the right, Vector 0,0,0, and if i get the normal will it face it the right way? the front facing out and the back against the wall?

                  Comment


                    #10
                    If the mesh faces right, which is rot 0,0,0 not vector, lol, then it should face the correct direction if you use the normal and convert to a rotator, since that gives you a rotator facing the direction the vector was facing, and since the vector is facing out, the rotator faces out, and thus setting the rotation of your mesh to this rotation makes it face out as well (assuming that 0,0,0 is to the right and not the left, in which case you could just stick a - in front of the normal before casting to rotator ).

                    Comment


                      #11
                      Yea i ment to say Rotator, Aight thx And how dies a vector convert to a rotator?
                      is it like, Vector(0,0,1) look up or something cuz the 1 is Z?

                      Comment


                        #12
                        Yes, Vect(0,0,1) would look up. Converting that to a rotator would give you a rotator that looks up.

                        Vectors can represent direction, as you know. So do rotators. So converting them is as simple as type casting them, and the engine handles the rest. Converting rotators to vectors returns a normalized vector pointing in the direction of the rotator.

                        Comment


                          #13
                          Ahhh, well thanks alot, weapon works perfect!

                          Comment


                            #14
                            While we're on this subject... anyone know which way rotator(vect(0,0,0) points? :bulb:

                            Comment


                              #15
                              By defintion it doesnt point anywhere, lol. But most likely it points to the right.

                              Comment

                              Working...
                              X