Raised This Month: $91 Target: $400
 22% 

Module: BMOD - Extended Physics Module


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Backup
Senior Member
Join Date: Jul 2010
Location: Česká Republika
Old 02-10-2012 , 17:11   Module: BMOD - Extended Physics Module
Reply With Quote #1



What is BMOD?
BMOD allows amxx developers to use physics engine (Bullet) inside their plugin. There are few videos, so you can get the idea, what kind of things can be achieve with this:
http://www.youtube.com/watch?v=WxbXrLsKFGQ
http://www.youtube.com/watch?v=Nn26KkoIGNY
http://www.youtube.com/watch?v=pAocm7bZszs
http://www.youtube.com/watch?v=CUmNRsVro1U
http://www.youtube.com/watch?v=vUCIKGlyDBQ
http://www.youtube.com/watch?v=fAJlHJehlI8

How does it work?
There is an API which gives you the ability to create dynamic, static or kinematic objects inside the "bullet world". After creating an dynamic object, you connect it to some entity and this entity now copies the object's movement. Dynamic objects can be used as anything that moves freely, for example pink rubber balls boucing all across the map. In case of static object, no movement is copied, but you can still work with the object, set its properties, etc. These can be used for building the world, making walls or triggers. Kinematic objects are exact opposite of dynamic objects - they copy their entity's movement. That is useful for player collision box or for moving brush entities like doors, trains, etc.

Documentation?
For documentation just grab latest inc file, everything should be written in there.

Hello world?

Here is a simple example where you can learn how to create static world, dynamic spheres, kinematic player collision box and modify behaviour of some objects (bounciness).

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")
}


More?
Download bmod_test.zip form the attached files. It contains more complicated example and also that fyzsph.mdl you might be looking for.
You can also check out CrateNade plugin.

Latest binaries/source

Download latest binaries from GitHub (windows,linux).
Download latest amxx include file from Github.
View latest source at GitHub.

Additional info
Your feedback, wishes and english mistakes corrections are appreciated!

Current linux release requires Bullet shared libraries to be put into hlds root directory. If there is anyone who can recompile this module for linux without the need for bullet shared libs, your help is very welcome.

Attached zip file might be several years old and contain some serious bugs.

If you're looking for old-api bmod, see legacy branch. It's full of bugs and has been discontinued.

Thanks joropito for helping me with GitHub and other support.
Attached Files
File Type: zip bmod_test.zip (16.8 KB, 389 views)
File Type: zip BMOD_20140818.zip (3.98 MB, 644 views)
__________________
Sorry for my english.

Last edited by Backup; 08-18-2014 at 10:43. Reason: v140818
Backup is offline
mabaclu
Senior Member
Join Date: Jun 2010
Location: Portugal
Old 02-10-2012 , 17:33   Re: Module: BMOD - Extended Physics Module
Reply With Quote #2

Finally released! Good job!
__________________
mabaclu is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 02-10-2012 , 18:07   Re: Module: BMOD - Extended Physics Module
Reply With Quote #3

I just cant belive it,

this is better than hl2 Physics omg.
Good job!
.Dare Devil. is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 02-10-2012 , 18:14   Re: Module: BMOD - Extended Physics Module
Reply With Quote #4

Sweet!
__________________
hleV is offline
zeus
Senior Member
Join Date: Jul 2008
Old 02-10-2012 , 18:42   Re: Module: BMOD - Extended Physics Module
Reply With Quote #5

Awsome work dude !!
We apreciate

Last edited by zeus; 02-10-2012 at 18:47.
zeus is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 02-11-2012 , 05:50   Re: Module: BMOD - Extended Physics Module
Reply With Quote #6

Quote:
Originally Posted by .Dare Devil. View Post
this is better than hl2 Physics omg.
Let's get real, it is not better than HL2 physics.
__________________
xPaw is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 02-11-2012 , 09:39   Re: Module: BMOD - Extended Physics Module
Reply With Quote #7

Quote:
Originally Posted by xPaw View Post
Let's get real, it is not better than HL2 physics.
I tested it and tested hl2 physics.
And i take back my words

But this module here, is so fucking awsome.
That bounce balls and spike physics is so nice.

I think it is impossible on hl2 physics
that way i said that is better than hl2 physics.

HL2 physics are too real
but better player touch...
.Dare Devil. is offline
Steelec
New Member
Join Date: Feb 2012
Old 02-11-2012 , 10:25   Re: Module: BMOD - Extended Physics Module
Reply With Quote #8

Awesome! Wery NICE! GJ ;)
Steelec is offline
Kiske
Veteran Member
Join Date: May 2009
Old 02-12-2012 , 08:05   Re: Module: BMOD - Extended Physics Module
Reply With Quote #9

EXCELENT!

You upload the plugin that samples in the video: http://www.youtube.com/watch?v=Nn26KkoIGNY ?
You upload the models/fyzsph.mdl ?

Last edited by Kiske; 02-12-2012 at 08:05.
Kiske is offline
Send a message via Skype™ to Kiske
Backup
Senior Member
Join Date: Jul 2010
Location: Česká Republika
Old 02-12-2012 , 09:37   Re: Module: BMOD - Extended Physics Module
Reply With Quote #10

Quote:
Originally Posted by Kiske View Post
EXCELENT!

You upload the plugin that samples in the video: http://www.youtube.com/watch?v=Nn26KkoIGNY ?
You upload the models/fyzsph.mdl ?
Code:
#include <amxmodx>
#include <engine>
#include <bmod>

public plugin_init() {
    register_plugin("bmod_test","0","asdf")
    register_concmd("bmod_test","_bmod_test")
}

new i=0

public _bmod_test(id){
    new entity = create_entity("func_wall")
    switch(i%5){
        case 0:{
            entity_set_model(entity,"models/fyzsph.mdl")
        }
        case 1:{
            entity_set_model(entity,"models/fyzbox.mdl")
        }
        case 2:{
            entity_set_model(entity,"models/fyzcyl.mdl")
        }
        case 3:{
            entity_set_model(entity,"models/fyzcap.mdl")
        }
        case 4:{
            entity_set_model(entity,"models/fyzcon.mdl")
        }
    }
    new Float:origin[3]
    entity_get_vector(id,EV_VEC_origin,origin)
    origin[2]+=128
    entity_set_origin(entity,origin)
    entity_set_float(entity,EV_FL_nextthink,86400.0)
    entity_set_int(entity,EV_INT_movetype,8)
    bmod_object_add(entity,i%5,1.0,24.0,24.0,24.0)
    i++
}

public plugin_precache(){
    precache_model("models/fyzsph.mdl")
    precache_model("models/fyzbox.mdl")
    precache_model("models/fyzcyl.mdl")
    precache_model("models/fyzcap.mdl")
    precache_model("models/fyzcon.mdl")
}
Attached Files
File Type: zip bmod_test.zip (80.7 KB, 369 views)
__________________
Sorry for my english.
Backup is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:27.


Powered by vBulletin®
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Theme made by Freecode