Results 1 to 5 of 5
  1. #1

    Default Rotating Vector Around Direction.

    Okay I'm playing with creating a simple weapon that launches a projectile that after 2 seconds releases 6 other projectiles in a kind of star pattern. To do this I need to rotate an offset rotation around the spawner's rotation angle. I've almost got it working correctly. The subprojectiles do launch in a star pattern, but around the wrong axis. I haven't figured out which axis this is, it seems to differ.

    local int i;
    local Rotator OffsetR;
    local Vector OffsetV;

    For (i = 0; i < 6; i++)
    {
    OffsetR.Pitch=4000;
    OffsetR.Yaw=0;
    OffsetR.Roll=0;

    OffsetV = QuatRotateVector(QuatFromAxisAndAngle(Vector(Rotat ion), i*(65536/6)), Vector(OffsetR));

    p = Spawn(class'WeaponL.RocketSSSubProj',,,,Rotation+R otator(OffsetV));

    }

  2. #2
    Boomshot
    Join Date
    Apr 2001
    Posts
    2,184

    Default

    Make sure your projectile is not rotating itself, this can throw stuff off
    "Mother, mother may I cry. Father will you
    teach me how to die the right way someday. I don't want a
    second chance to turn my stuttering reluctance into romance..."

  3. #3

    Default

    The projectile only rotates itself after it has been spawned.

    I'm not too good with Quats. Are you sure this calculation cannot be done with regular vector/rotator math? Like, get a blank vector, give it a Yaw rating for the star point, and then rotate it by the projectile's rotation.

  4. #4

    Default

    Quote Originally Posted by Xyx View Post
    The projectile only rotates itself after it has been spawned.

    I'm not too good with Quats. Are you sure this calculation cannot be done with regular vector/rotator math? Like, get a blank vector, give it a Yaw rating for the star point, and then rotate it by the projectile's rotation.
    I'm sure it probably could be done with euler. But I can do it with a single line with Quats. The solution turned out to be to add the orignial direction before calculating the offset.

    For (i = 1; i < 7; i++)
    {
    OffsetR.Pitch=4000;
    OffsetR.Yaw=0;
    OffsetR.Roll=0;

    OffsetV = QuatRotateVector(QuatFromAxisAndAngle(Vector(Rotat ion), i), Vector(Rotation+OffsetR)); //I have no idea why the variable 'i' works for the rotation.


    p = Spawn(class'WeaponL.RocketSSSubProj',,,,Rotator(Of fsetV));
    p.SetDrawScale(0.25);
    }

  5. #5

    Default

    You can do it in a single line using Euler as well, so I fail to see your point.


 

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.