AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Model collision with world (https://forums.alliedmods.net/showthread.php?t=57340)

sgtbane 07-02-2007 19:49

Model collision with world
 
I cant get collisions to work properly with my created entity.

Code:

public makeapc(id)
{
        new Float:origin[3]
        pev(id, pev_origin, origin)
        new apc = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
        if(!apc)
        {
                client_print(id,print_chat,"Error: APC WAS not created.")
                return PLUGIN_HANDLED
        }
        client_print(id, print_chat, "APC: %i", apc)
        set_pev(apc, pev_classname, "item_apc")
        dllfunc(DLLFunc_Spawn, apc)
       
        new Float:angles[3] = {0.0, 0.0, 0.0}
        new Float:fmins[3] = {-80.0, -80.0, -90.0}
        new Float:fmaxs[3] = {80.0, 80.0, 0.0}
       
        engfunc(EngFunc_SetModel, apc, "models/banes/APC03.mdl")
        origin[2] += 90
        engfunc(EngFunc_SetOrigin, apc, origin)
        engfunc(EngFunc_SetSize, apc, mins, maxs)
       
        set_pev(apc, pev_angles, angles)
        set_pev(apc, pev_takedamage, 1.0)
        set_pev(apc, pev_health, 500.0)
        set_pev(apc, pev_movetype, MOVETYPE_PUSHSTEP)
        set_pev(apc, pev_solid, 2)
       
        set_pev(apc, pev_nextthink, get_gametime() + 0.01)
        dllfunc(DLLFunc_Think, apc)
        return PLUGIN_HANDLED
}

The bounding box doesen't seem to want to collide with all walls. It will collide with players, but when driving into walls, the maxs half of the box just go right through the walls.
Ignore the z axis box. It extends below since the center bone of the model is in the center-top of the model so that when attaching a camera you can view above it.

I am trying to make a driveable vehicle that will be able to hold multiple people, where you simply walk up to it, press your key, instead of the crappy cars built into cs.
I am doing this for the possibility of:
vehicles that take damage, mobile mounted weapons, and hopefully better physics then the default 1.6 ones.

any help with the collisions would be aprecieated.
Thanks.

sgtbane 12-12-2008 19:55

Re: Model collision with world
 
Bump? o.0

I never got a response to this and am still having problems with this type of thing. When I set the bounding box of something, the 'maxs' half of it is totaly ignored as if it assumes them to be 0. If anyone has a solution to this it would be greatly appreciated.

new Float:mins[3] = {-50.0, -50.0, -50.0}
new Float:maxs[3] = {50.0, 50.0, 50.0}
engfunc(EngFunc_SetSize, entid, mins, maxs)

The bounding box appears to be the proper size when running around the entity, since you can collide with the bounding box as a player in the places that you should. yet when you try to move the entity with velocity, it will only collide on the 'mins' half of the bounding box and assume the 'maxs' is 0,0,0

Vet 12-13-2008 00:52

Re: Model collision with world
 
Have you tried SOLID_BSP?

stupok 12-15-2008 13:27

Re: Model collision with world
 
I haven't played with this myself yet, but what happens if you put dllfunc(DLLFunc_Spawn, apc) at the end rather than before setting size, origin, and other properties?

Also, try looking for a plugin that does something similar. That's probably the fastest way to figure out how to do it properly. I don't have any plugins in mind right now, sorry.

ConnorMcLeod 12-15-2008 13:51

Re: Model collision with world
 
Set pev_solid before the entity size (you shouldn't have to spawn it).


All times are GMT -4. The time now is 21:29.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.