View Single Post
Backup
Senior Member
Join Date: Jul 2010
Location: Česká Republika
Old 07-31-2014 , 10:55   Re: Module: BMOD - Extended Physics Module
Reply With Quote #127

OK, pushed to master. I don't have any helloWorld plugin right now, only documentation you can have is bmod.inc. There is no linux binary yet and there might be lot of server-freezing bugs or not working features.

I'd be glad if you took a look at that .inc file and told me, what do you think about that new API.
I'll try to provide some helloworld and linux binary asap.

Edit: I've rewritten that bouncy-balls helloworld plugin for the new api:
Code:
#include <amxmodx>
#include <amxmisc>
#include <bmod>
#include <engine>

new worldObj

public plugin_init() {
    register_concmd("bmod_test","_bmod_test")
    //create static bmod object from worldspawn
    worldObj = bmod_obj_from_ent(0)
    //set world friction and restitution
    bmod_obj_call(worldObj, "setFriction", 1.0)
    bmod_obj_call(worldObj, "setRestitution", 1.0)
}

public _bmod_test(id){
    //create a new entity
    new entity = create_entity("func_wall")
    entity_set_model(entity,"models/fyzsph.mdl")
    //set entity origin 128 units above player
    new Float:origin[3]
    entity_get_vector(id,EV_VEC_origin,origin)
    origin[2]+=128
    entity_set_origin(entity,origin)
    //set some movetype and nextthink, so entity movement is smoother (because of velocity and avelocity)
    entity_set_float(entity,EV_FL_nextthink,86400.0)
    entity_set_int(entity,EV_INT_movetype,8)
    //create new bmod object
    new object = bmod_obj_new("BMOD/sphere/24", 1.0)
    //hook entity with bmod object
    bmod_obj_assign_ent(object, entity)
    bmod_obj_update_pos(object)
    
    //set object friction and restitution
    bmod_obj_call(object, "setFriction", 2.0)
    bmod_obj_call(object, "setRestitution", 0.88)
}

public client_connect(plr){
    //create collision box for a player
    new obj = bmod_obj_new("BMOD/box/16/16/36")
    bmod_obj_assign_ent(obj, plr)
    bmod_obj_set_kinematic(obj, true)
}

public client_disconnect(plr){
    bmod_obj_delete(bmod_obj_by_ent(plr))
}

public plugin_precache(){
    precache_model("models/fyzsph.mdl")
}
EDIT2:
Here's a video that shows the possibilities of the new api (brush entity collision and fake water buoyancy):
https://www.youtube.com/watch?v=pAocm7bZszs
__________________
Sorry for my english.

Last edited by Backup; 08-03-2014 at 13:34. Reason: video \o/
Backup is offline