Results 1 to 8 of 8

Thread: Get mins and maxs of entity's current bounding box

  1. #1
    Developer Sor's Avatar
    Join Date
    Aug 2010
    Location
    The Medieval City of Bruges
    Posts
    747

    Default Get mins and maxs of entity's current bounding box

    Strange that no one has proposed it earlier but Spearhead has 'getmins' and 'getmaxs' commands for the Entity class which returns
    the minimum and maximum setsize options respectively. This is because the original 'setsize' command only sets vectors so in AA we'd
    have to do something like this (Elgan's algorithm by the way) to get the values again:
    Code:
    GetBBox local.object:
    
        if (local.object == NIL && self != NULL)
            local.object = self
        else if (local.object == NIL && self == NULL)
            end
    
    
        local.fwd = waitthread getbound 1 ( 1 0 0 ) local.object
        local.bwd = waitthread getbound 0 ( 1 0 0 ) local.object
    
    
        local.right = waitthread getbound 1 ( 0 1 0 ) local.object
        local.left = waitthread getbound 0 ( 0 1 0 ) local.object
    
    
        local.up = waitthread getbound 1 ( 0 0 1 ) local.object
        local.down = waitthread getbound 0 ( 0 0 1 ) local.object
            
        local.BBox[0] = ( -local.bwd -local.left -local.down )
        local.BBox[1] = ( local.fwd local.right local.up )
    
    
    end local.BBox
    
    
    getbound local.dir local.vector local.model:
    
    
        local.item = spawn script_origin origin local.model.origin
        local.item.angles = local.model.angles
        local.item setsize ( 0 0 0 ) ( 0 0 0 )
    
    
        for(local.i = 0;local.item istouching local.model; local.i++)
        {
            if(local.dir == 1)
            {
                local.item.origin += local.vector * 1
            }
            else
            {
                local.item.origin -= local.vector * 1
            }
        }    
    
    
        local.item delete
            
        local.i = ( local.i * local.model.scale + 6) - 11.5
    
    
    end local.i
    Would this be hard to do? I mean, the vectors are just stored internally on entities of the Entity class and all its children classes alike.
    Morpheus Script (MoH) => You try to shoot yourself in the foot only to discover that MorpheusScript already shot your foot for you.

  2. #2

    Default

    Mefy Freeze tag have a good mod for modeling sectors for the locations on the map

    If you whant to have a look on the file i will share the file

  3. #3
    Developer Sor's Avatar
    Join Date
    Aug 2010
    Location
    The Medieval City of Bruges
    Posts
    747

    Default

    Huh? Not sure if we're on the same page here. By 'setsize' and 'bounding box', I specifically mean this (i.e. the white lines):
    http://moh.teasarspalace.com/pages/obstacle.htm

    This is the bbox of the entity. When you solidify that entity the entire contents of that box becomes solid. You can change it size
    and save that change as property to the entity you used it on but if someone already changed it and isn't as thoughtful to
    save the change in the exact same property, then we have to resort to retrieving the bounding box values by using the
    algorithm above. Not only is it far slower this way, but it should be unnecessary to do this.
    Last edited by Sor; February 10th, 2013 at 06:26 AM.
    Morpheus Script (MoH) => You try to shoot yourself in the foot only to discover that MorpheusScript already shot your foot for you.

  4. #4
    Administrator James's Avatar
    Join Date
    May 2010
    Location
    on the intraweb
    Posts
    3,180

    Default

    If I remember correctly I was playing around with bboxes a while ago. Part of the reason that STWH is possible in MOHAA (and not any other q3 engine) is because of a fairly big flaw in the player bbox.

    I'm sure I mentioned this before, I think the default player bbox is something like 16,-16,0 (going off memory here), however when the player leans, the bbox should also expand accordingly. When a player leans I believe the bbox increases by 12,-12,0 units which means the total should be 28,-28,0.

    NOTE: My numbers may be off, but the logic is still the same.

    Anywho, because the player leans outside of the default bbox, that's why you see players sometimes clipping through walls (even without STWH), however with STWH it intensifies the effect.

    Anywho, don't want to get off topic, but I was trying to initially fix STWH by increasing the bbox during leans.

    I ran into a problem though.
    I was able to increase the bbox via script for a split second before the engine overwrote it (so yes, if you were to make a change in the engine, it should be possible)

    Now we just check to see if the weapon is clipping and that works well to fix the problem.

  5. #5
    Developer Sor's Avatar
    Join Date
    Aug 2010
    Location
    The Medieval City of Bruges
    Posts
    747

    Default

    Yes , I remember Lamron was struggling with the player's bboxes a few years ago.
    Found it: http://www.modtheater.com/threads/pl...ing-box.32127/

    So these commands would only be good for entities whose bounding boxes can change (or have to be set after you spawned it).
    Morpheus Script (MoH) => You try to shoot yourself in the foot only to discover that MorpheusScript already shot your foot for you.

  6. #6

    Default

    Is there a way to display players hitboxes ( the one that the bullet tracert detect ) in game ?
    I'm pretty sure i have seen a video of that before but i can be wrong...

  7. #7
    Administrator James's Avatar
    Join Date
    May 2010
    Location
    on the intraweb
    Posts
    3,180

    Default

    I think there may be a cvar to do it. I can't recall atm.

  8. #8
    Developer Sor's Avatar
    Join Date
    Aug 2010
    Location
    The Medieval City of Bruges
    Posts
    747

    Default

    'r_showhbox' perhaps? It appears to be a cheat-protected cvar.
    Morpheus Script (MoH) => You try to shoot yourself in the foot only to discover that MorpheusScript already shot your foot for you.

Posting Permissions

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