AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Module Coding (https://forums.alliedmods.net/forumdisplay.php?f=9)
-   -   Module: BMOD - Extended Physics Module (https://forums.alliedmods.net/showthread.php?t=178066)

ot_207 02-16-2012 05:08

Re: Module: BMOD - Extended Physics Module
 
The only thing that I would suggest with this module is to make it an interface to all the possible functions of the Bullet physics.

Also it would be a good idea to add get natives.
For example: bmod_get_friction and is_bmod_registered.

And forwards if the bmod library can offer.

Also request for the mods of the forums.
Sticky PLEASEEE!!!

Backup 02-17-2012 11:39

Re: Module: BMOD - Extended Physics Module
 
Ok, added more natives, look at the include file for complete list.
In this video i'm using last bullet hit for traceline end point because i'm too lazy to get it from player angles. I set gravity (or apply force at hit point) of traced object by console bind.
http://www.youtube.com/watch?v=fAJlHJehlI8

So if you want objects reacting to bullets or explosions, use bmod_traceline and bmod_object_apply_force_at (this takes relative position, so substract it from entity origin).

mabaclu 02-17-2012 17:22

Re: Module: BMOD - Extended Physics Module
 
What about joining objects? It would allow coders to make more complex objects by joining cylinders, cones, boxes, etc.

ot_207 02-18-2012 02:27

Re: Module: BMOD - Extended Physics Module
 
Quote:

Originally Posted by Backup (Post 1652261)
Ok, added more natives, look at the include file for complete list.
In this video i'm using last bullet hit for traceline end point because i'm too lazy to get it from player angles. I set gravity (or apply force at hit point) of traced object by console bind.
http://www.youtube.com/watch?v=fAJlHJehlI8

So if you want objects reacting to bullets or explosions, use bmod_traceline and bmod_object_apply_force_at (this takes relative position, so substract it from entity origin).

Beautiful. I will make a physics plugin soon :mrgreen:.

Things that I like to request:
1. Module autoloading
2. Some forwards, don't know if the bmod library has something like that.
3. Also I think that it would be a good idea to make the object properties set function just like engine this is good when this module will provide more and more functions that we can play with. bmod_set_float(ent, BM_gravity/BM_restitution, gravity).

Quote:

Originally Posted by mabaclu (Post 1652447)
What about joining objects? It would allow coders to make more complex objects by joining cylinders, cones, boxes, etc.

Another alternative to your suggestion would be to make the bullet engine support custom models. Like the player models for instance, though I don't know if this bullet physics will be able to support this.

Backup 02-18-2012 14:56

Re: Module: BMOD - Extended Physics Module
 
Quote:

Originally Posted by ot_207 (Post 1652599)
1. Module autoloading

Sorry, i don't get it, what is it?
Anyway i've done everything else: engine-like variables handling and one simple callback called when body contact is made. You can use it for sound effects, as i tried to in this video:
http://www.youtube.com/watch?v=0tpyPSHG96s
Quote:

Originally Posted by ot_207 (Post 1652599)
Another alternative to your suggestion would be to make the bullet engine support custom models. Like the player models for instance, though I don't know if this bullet physics will be able to support this.

Player models are too complex for physics simulation. I'm going to add support for model trimesh (including both map brush model (beginning with *) and studio model (.mdl files)).

zeus 02-18-2012 15:03

Re: Module: BMOD - Extended Physics Module
 
Module autoloading means when a plugin is using the module it will autoload even if it is not enabled from modules.ini ( i guess ) :D

mabaclu 02-18-2012 18:10

Re: Module: BMOD - Extended Physics Module
 
The "callback when body contact is made" is not working, can you give me an example script please?

Backup 02-18-2012 18:28

Re: Module: BMOD - Extended Physics Module
 
You have to call bmod_object_set_callback(entity,1) on objects you want to get callback from.
Code:

public whatever(){
    ...
    new Float:size[3] = {24.0,24.0,24.0}
    bmod_object_add(entity,BMOD_sphere,1.0,size)
    bmod_object_set_callback(entity,1)
}
public bmod_forward_contact(ent1,ent2,Float:distance){
    ...
}

If you don't want to get callback anymore, call bmod_object_set_callback(entity,0).

Is this bad 'feature'? Should every object call this callback automaticly?

mabaclu 02-18-2012 18:34

Re: Module: BMOD - Extended Physics Module
 
Look at my code, it's not working. Nothing happens when 2 balls collide:
Code:

#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <bmod>

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

public _bmod_test(id){
        new entity = create_entity("func_wall")
        entity_set_model(entity,"models/fyzsph.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)
        new Float:size[3] = {24.0,24.0,24.0}
        bmod_object_add(entity,BMOD_sphere,1.0,size)
        new Float:gravity[3] = {0.0,0.0,-2.0}
        bmod_object_set_vector(entity, BMOD_VEC_gravity, gravity)
        bmod_object_set_callback(entity,1)
}
public plugin_precache(){
        precache_model("models/fyzsph.mdl")
}

public bmod_forward_contact(ent1,ent2,Float:distance){
        client_print(0, print_chat, "ent1: %i; ent2: %i; distance: %f", ent1, ent2, distance)
}

Quote:

Originally Posted by Backup (Post 1653004)
Is this bad 'feature'? Should every object call this callback automaticly?

Detecting collisions is a great feature but _set_callback may be an useless native.

I've looked at the source code and i don't see bmod_forward_contact. Did you forget it?

GordonFreeman (RU) 02-18-2012 23:30

Re: Module: BMOD - Extended Physics Module
 
Can i add bmod physics for other in game ents? Not creating new ent.
(example. granades with bmod physics)


All times are GMT -4. The time now is 01:33.

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