Results 1 to 10 of 16

Thread: Get angle of wall

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Private
    Join Date
    Oct 2013
    Posts
    48
    Thanks
    10
    Thanked 4 Times in 2 Posts
    Quote Originally Posted by kung foo man View Post
    Would be useful if you post video with debug printbolds of normal + calculated angle.

    And show your exact code with your orientToNormal function.

    And try what IzNoGoD said: portal.angles = vectorToAngles(trace["normal"]);

    And add more surfaces to your map, which aren't all straight walls. Lots of different slopes to test all kinds of trace normals (or just test in a stock map, should have more variety in surfaces).
    The code behind the portal is this:
    Spoiler:

    Code:
    function watchAttack()
    {
        player = self;
        orangePortal = util::spawn_model("portal_orange", (0,0,-1000000), 0);
    
        i = 1;
    
        while(isDefined(player))
        {
            if(player AttackButtonPressed() && !player ThrowButtonPressed())
            {
                newPos = player _utils::lookAt(orangePortal);
    
                if(!isDefined(newPos))
                {
                    WAIT_SERVER_FRAME;
                    continue;
                }
    
                orangePortal.origin = newPos["position"];
                orangePortal.angles = VectortoAngles(newPos["normal"]) + (0,90,0);
                orangePortal.lookupNormal = newPos["normal"];
                orangePortal MoveZ(2,0.1);
    
                player IPrintLn(" ");
                player IPrintLn(" ");
                player IPrintLn(" ");
                player IPrintLn(i + ". GetPlayerAngles: " + player GetPlayerAngles());
                player IPrintLn(i + ". Normal: " + newPos["normal"]);
                player IPrintLn(i + ". orientToNormal: " + _utils::orientToNormal(newPos["normal"]+(0.01,0.01,0.01)));
                player IPrintLn(i + ". VectorToAngles: " + VectortoAngles(newPos["normal"]));
                i += 1;
    
                if(!isDefined(player.orangePortal))
                    player.orangePortal = orangePortal;
    
                while (self AttackButtonPressed())
                	WAIT_SERVER_FRAME;
            }
    
            WAIT_SERVER_FRAME;
        }
    
        orangePortal Delete();
    }


    orientToNormal:
    Spoiler:

    Code:
    function orientToNormal(normal)
    {
    	horNormal = (normal[0], normal[1], 0);
    	horLength = Length(horNormal);
    
    	if(!horLength)
    		return(0,0,0);
    
    	horDir = VectorNormalize(horNormal);
    	negHeight = normal[2] + -1;
    	tangent = (horDir[0] * negHeight, horDir[1] * negHeight, horLength);
    	plantAngle = VectortoAngles(tangent);
    
    	return plantAngle;
    }


    lookAt:
    Spoiler:

    Code:
    function lookAt(toIgnore)
    {
    	player = self;
    
    	originStart = player GetEye() + (0,0,25);
    	angles = player GetPlayerAngles();
    	forward = AnglesToForward(angles);
    
    	originEnd = originStart + VectorScale(forward, 1000000);
    
    	trace = BulletTrace(originStart, originEnd, false, toIgnore);
    
    	if (trace["fraction"] == 1)
    		return undefined;
    
    	return trace;
    }


    Its basically the same as in your portal mod. Its the stuff you have send me while i was trying to create the mod for cod4 years ago.
    The only difference i have found is that vectorScale is a build in function now, but i tested it with your vectorScale function too, no differences.

    I added more walls to my testmap so that there are more different angles to test on, i also added a few prints. If you need any other prints, let me know.

    New Video:
    https://www.youtube.com/watch?v=SunWQUnDbyU

    In the video i'm using
    Code:
    orangePortal.angles = VectortoAngles(newPos["normal"]) + (0,90,0);
    For now its the closest i can get to what i want.
    As you can see, its perfect for walls in any angle, but as soon as it gets to the ground or some kind of a ramp, its not working anymore.
    And for some reason the portal is sometimes stuck inside of the walls (starting at 9sec. in the video).


    Quote Originally Posted by Ni3ls View Post
    Which COD is that in your video Trance?
    Its Black Ops 3.
    Last edited by DjTranceFire; 27th October 2016 at 12:43.

  2. The Following User Says Thank You to DjTranceFire For This Useful Post:

    Ni3ls (27th October 2016)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •