Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: canPlaceSentry()

  1. #1
    Private First Class RobsoN's Avatar
    Join Date
    Jan 2013
    Location
    /home/cod2/
    Posts
    230
    Thanks
    119
    Thanked 95 Times in 64 Posts

    canPlaceSentry()

    Hello, I'm reworking my sentry gun to cod mw2 + style. How can I check whether the turret is in the wall or located in the wrong place (red/yellow model thing)? Should I use 3 bullettrace to check collision with x y z axis? Have you any better ideas?

    Regards, Robson.
    "Don't worry if your code doesn't work correctly - if everything worked, you would not work" ~Mosher's right

  2. #2
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts
    either that or play around with physicstrace() & positionwouldtelefrag()

  3. The Following User Says Thank You to serthy For This Useful Post:

    RobsoN (31st October 2013)

  4. #3
    Private First Class RobsoN's Avatar
    Join Date
    Jan 2013
    Location
    /home/cod2/
    Posts
    230
    Thanks
    119
    Thanked 95 Times in 64 Posts
    Can you explain a bit how does "physicstrace" work and how can I use it?
    "Don't worry if your code doesn't work correctly - if everything worked, you would not work" ~Mosher's right

  5. #4
    Private
    Join Date
    Jun 2013
    Posts
    70
    Thanks
    20
    Thanked 32 Times in 26 Posts
    hi here this is an example
    deploy()
    {
    self endon("disconnect");
    self endon("death");

    angles = self getPlayerAngles();
    start = self.origin + (0,0,40) + maps\mp\_utility::vectorScale(anglesToForward( angles ), 20);
    end = self.origin + (0,0,40) + maps\mp\_utility::vectorScale(anglesToForward( angles ), 38);

    left = maps\mp\_utility::vectorScale(anglesToRight( angles ), -10);
    right = maps\mp\_utility::vectorScale(anglesToRight( angles ), 10);
    back = maps\mp\_utility::vectorScale(anglesToForward( angles ), -6);

    canPlantThere1 = BulletTracePassed( start, end, true, self);
    canPlantThere2 = BulletTracePassed( start + left, end + left + back, true, self);
    canPlantThere3 = BulletTracePassed( start + right , end + right + back, true, self);
    if( !canPlantThere1 || !canPlantThere2 || !canPlantThere3 )
    {
    return false;
    }


    trace = bulletTrace( end + (0,0,100), end - (0,0,300), false, self );
    if(trace["surfacetype"] == "default" || trace["surfacetype"] == "none")
    {

    return false;
    }


    return true;
    }

  6. #5
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts
    physicsTrace() is a volume trace that checks against the players volume

  7. #6
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by RobsoN View Post
    Can you explain a bit how does "physicstrace" work and how can I use it?
    physicstrace ignores players on a server. It is better for returning a vector than bullettrace is.
    Last edited by Tally; 1st November 2013 at 10:34.

  8. #7
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by serthy View Post
    physicsTrace() is a volume trace that checks against the players volume
    No, physicstrace ignores players.

  9. #8
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by vanfreddy View Post
    hi here this is an example
    That's bullettrace Pal. Not physicstrace:

    Code:
    PhysicsTrace( <start>, <end> )
    Module: Trace
    
    Summary:
    
    Physics trace, ignoring characters. Returns the endpos vector.
    
    
    Example:
    
    endpos = PhysicsTrace( start, end );
    
    
    
    Required Args:
    
        1 : <start> The start point
        2 : <end> The end point

  10. The Following User Says Thank You to Tally For This Useful Post:

    RobsoN (1st November 2013)

  11. #9
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts
    Quote Originally Posted by Tally View Post
    No, physicstrace ignores players.
    physicsTrace is just a volume-trace, easier said, it tells you the last possible place between startVec and endVec where a player could stay

  12. #10
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by serthy View Post
    physicsTrace is just a volume-trace, easier said, it tells you the last possible place between startVec and endVec where a player could stay
    The script function specifically states: "ignoring characters". Ignoring characters = ignoring players.

Posting Permissions

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