Sorry its taken me so long to actually look into this, I've been a little distracted by other things lately.
It also doesn't help that this forum is still swallowing long posts - that'll teach me to verify what I'm saying huh.
I don't have any plans regarding bullet. I've actually committed what I have now, but there's still no public build. It would be nice to get both working, but I don't personally have the interest at this time.
to get ode working now that its a plugin, you need to load up fte, go into the packages/updates menu (hidden somewhere on the options menu), and enable 'Plugins/ODE Plugin', the one with 5093+ after it.
(make sure there's no simple 'ode' entry listed, because that's one that you've manually installed and will be older - you can delete it from the updates menu).
the plug_load command should also work, but only until you exit the game.
Note that if you have a manifest file, you can put this into it and the user will be 'strongly encouraged' to download+enable the plugin streamlining what is above - this ONLY works for the default.fmf file. Other fmf files will be ignored if they try these lines.
Code: Select all
downloadsurl "https://fte.triptohell.info/downloadables.php"
install "Plugins/ODE Plugin"
Use these cvar settings. You should put them in your mod's default.cfg file.
Code: Select all
//apparently I was trying to mess with damping, and it was too strong (0.005 is apparently too high...). 5093 has revised defaults, but its possible a config file's settings will linger if a user had cfg_save_all set to 1.
set physics_ode_world_damping 0
//force a fixed tick rate, to stop things from suddenly exploding.
sv_mintic 0.013
sv_maxtic 0.013
In combination with the ode plugin being enabled via the updates menu, ode should now be functional.
At the end of W_FireGrenade:
Code: Select all
missile.movetype = MOVETYPE_PHYSICS;
missile.solid = SOLID_PHYSICS_CYLINDER;
setsize(missile, '-16 -4 -4', '16 4 4');
missile.mass = 1;
Your grenades will now obey physics better, as well as knock each other around.
They'll also roll along the floor and spin faster if they hit walls at an angle, etc.
At the bottom of PlaceItem:
Code: Select all
if (substring(self.model, -4, -1) == ".bsp")
{
self.mass = 1;
self.solid = SOLID_PHYSICS_BOX;
self.movetype = MOVETYPE_PHYSICS;
self.origin_z += 1; //move stuff up again slightly, in the hope that they won't ping across the map in a stupid way.
}
Your ammo boxes will now be physics objects. You can fire grenades at them and they'll get knocked over and fall against each other, etc.
If you wish to create a joint, you need a new entity.
Code: Select all
void(entity e1, entity e2) makeajoint =
{
entity j = spawn();
j.movetype = MOVETYPE_NONE; //actually, it will move...
j.origin = (e1.origin + e2.origin)*0.5; //hinges need pivots, for instance.
j.angles = vectoangles(e1.origin - e2.origin); //and sometimes an orientation.
j.enemy = e1;
j.aiment = e2;
j.movedir = [Vel, -FMax, Stop]; //various properties, depending on the joint type. if the y arg is positive then its [K, D, Stop] with CFM and ERP calculated from those and gahwthisthat. Or you can just leave it set to 0 0 0 and see what you get.
j.jointtype = JOINTTYPE_POINT;
};
The above code will join the two physics bodies together with a joint. A body can be affected by multiple joints at a time of course, and in doing so you can connect complex objects together.
Really though, once you have ODE starting up the rest should be the same as DP, except that FTE's ODE support also works in csqc, and for the extra .doll stuff. I mention this because you might find better docs there.
Note that JOINTTYPE_POINT creates a ball+socket. the two ents will both rotate around the joint's origin (and possibly move the joint around with them. If one of your bodies is the world entity then you should be able to leave the other body dangling from it. FMax specifies some sort of angle limit, iirc.
If you have multiple physics bodies and some skeletal bones, you can use skel_set_bone_world to force those bones to be rendered where the physics bodies are.
Alternatively, as Nahuel asked for, you can create a .doll file and then set self.frame|=0x8000; for the frames that you want it to fully flop. You can do this purely from ssqc without any need to deal with csqc and its skeletal objects. However, you do need to be able to figure out the .doll [text file] format, and its almost totally undocumented.