Results 1 to 3 of 3
  1. #1
    MSgt. Shooter Person
    Join Date
    Jul 2011
    Posts
    98

    Default unreal script operator >> or << is to do what

    Code:
    var Vector CameraOffset,result;
    result = CameraOffset >> Rotation;
    operator << or >> is to do what.sorry for my bad english,I dont know the result should be what.

  2. #2

    Default

    [Vector] << or >> [Rotator]

    << rotates vector in the way described by rotator. >> is the same, except direction reversed.
    Try my game Never End, now on the App Store! For more info, see the release thread.

    My Blog: WillyG Productions - Your Premiere UDK Resource
    My YouTube Channel: WillyG Productions
    My Facebook Page: WillyG Productions

  3. #3

    Default

    Actually it's not really just a rotation, but a coordinate system transformation. Imagine you look through a camera that is somehow oriented in 3 space and you have an offset vector relative to your camera view, e.g. the position of your weapon. The operation (OffsetVector >> CameraRotation) now takes the camera-local offset vector and calculates the global (i.e. in actual world coordinates) offset vector that you could use to actually position the weapon mesh in world space so its offset in camera space (i.e. your view) is what you'd expect.

    The math behind that transformation is relatively complex, but it can be expressed in a few simple terms through other UnrealScript operations:
    Code:
    static final operator(22) vector >> (vector A, rotator B)
    {
      local vector X, Y, Z;
    
      GetAxes(B, X, Y, Z);
      return A.X * X + A.Y * Y + A.Z * Z;
    }
    That's not how it actually happens in native code, but it's an exact description of the effect. Basically the three axis unit vectors of the camera rotation's local coordinate system are multiplied by the corresponding scalar components of the offset vector. The three new vectors are then combined to the transformed offset vector in world coordinates.

    The << operator performs the opposite transformation: from a global offset to a local offset.
    These two transformations are part of the Canvas.(De)Project magic. The conversion between the local offset vector and screen coordinates additionally takes FOV into account, but that's a whole different story.
    Wormbo's UT/UT2004/UT3 mods | PlanetJailbreak | Unreal Wiki | Liandri Archives

    <elmuerte> you shouldn't do all-nighters, it's a waste of time and effort
    <TNSe> nono
    <TNSe> its always funny to find code a week later you dont even remember writing
    <Pfhoenix> what's worse is when you have a Star Wars moment
    <Pfhoenix> "Luke! I am your code!" "No! Impossible! It can't be!"
    Note that your questions via PMs will be ignored if they actually belong in the forum.


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.