Announcement

Collapse
No announcement yet.

Teleported into a wall or not?

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

    Teleported into a wall or not?

    I'm totallt new to UnrealScript (actually, I haven't looked into the syntax yet
    at all) but I'm planning on taking time and study it. However, I have a
    question right now that I think wouldn't be too hard to answer.

    The question is, can you "easily" ask the game if a certain coordinate is inside
    a wall or in the open? What you'd ask the game would probably be if a
    coordinate is inside a subtraction brush and not inside an addition brush, sort
    of. Just a guess.

    For example; say I'd like to make a mutator that when you shot someone with
    some sort of gun, the target player gets randomly teleported somewhere on
    the map. I'd then want to check if this random target coordinate is a valid
    target for the player or not. Of course, one problem would be that I'd have to
    check somehow if the player actually fits in the target location so that
    the player won't end up stuck inbetween two boxes or something.

    Perhaps an interesting discussion. Would this be easy or overly complicated?
    The question I want to know primarily is "can you check if a coordinate is in
    air or inside a wall/mesh/collisionbox?". The random teleport weapon was
    -just- an example.

    Cheers!


    EDIT: Oh and I forgot - I'm talking about UT2004 mainly. But something tells me
    it will be of no difference in this case.

    #2
    Yes you can sort of test whether or not a coordinate is in subtractive space. Take a look at the source code for the actor class and the Setlocation function. It only returns true if the actor can fit there (take a look at the teleporter code as well).

    Of course just randomly pulling coordinates out of mid air will more than likely always result in a location that is not in subtractive BSP space. I would recommend that you cycle through the level's navigation point list to get a random location that should be in subtractive space.

    Comment


      #3
      Thanks for the link. This seems interesting, and relatively easy. It says, however, that SetLocation is somewhat "slow" - is that true for today's computers also? Will it create lag in network games, or something? It's not like what I'm thinking of doing will cause 10 teleports per second, but maybe one every two to ten seconds, roughly.

      What does the translocator use? I've been in matches where the players use it a lot, and it doesn't seem to slow down anything.

      What I don't like with SetLocation is that it will tweak the target coordinate a little if it has to. It would be nice if one could have it check the target location and return true if it's "free" and false if it's obstructed, and NOT tweak the actor so it fits. Maybe this is possible?

      Comment


        #4
        The actor is not tweaked, only the position. So say for instance your teleport location would place a pawn "slightly" into a wall (say 5-8 UUs). When you try to set the pawn to that location (using SetLocation), it will automatically adjust the location so that the pawn does not get stuck in the wall.

        Comment


          #5
          Hm, yeah that was what I meant (I might have been vague). In the example you gave, I'd rather want the function to return false instantly if it was inside the wall, instead of it tweaking/adjusting. But, I haven't tried it yet and maybe it's not really a problem for what I want to do.

          Comment


            #6
            It will (should?) return false immediately if the point is actually in the wall (as opposed to having a portion of the actors collision cylinder in the wall).

            Comment


              #7
              Ah, now I see... I'm just not used to the termonology or whatsitcalled. I understand now that the actual coordinate that I want to test might be in the clear, but that the player actor may be partly in the wall.

              But I'd like it to say "false" if the actor collision cylinder is partly inside the wall too. I'd like it to say "true" only if the target location really is clear for the entire actor. But as I said, maybe it's not necessary, as I haven't tried it out myself yet.

              Comment


                #8
                Why dont you use all PathNodes, Playerstarts, JumpPads, etc. [NavigationPoints] as a place to teleport? So the teleported pawn will respawn at a NavigationPoint which always are NOT in a wall

                Greez

                KillerVirus

                Comment


                  #9
                  For the idea I have, you need to be able to teleport rather freely. Ah, anyhow. I'll get back to the thread when I go into scripting ^^

                  Comment

                  Working...
                  X