Using ODE physics? [Darkplaces]
Moderator: InsideQC Admins
3 posts
• Page 1 of 1
Using ODE physics? [Darkplaces]
I am just experimenting with ODE and trying to get the physics to actually work, but I can't seem to get a start on it. I set the cvar "ode_physics" to 1, and I wrote this code in the impulse commands.
I was just plugging things in, trying to get something to happen with my test1.bsp(a box). However, the box just spawns in mid-air and doesn't move. What code to I have to use to get the object to work?
- Code: Select all
case 13:
//Utilize a traceline
makevectors (self.v_angle);
vector source;
source = self.origin + '0 0 16' + v_forward * 10;
traceline (source, source + v_forward*150, FALSE, self);
local entity box;
box = spawn();
box.solid = SOLID_PHYSICS_BOX;
box.movetype = MOVETYPE_PHYSICS;
box.classname = "Physics";
setorigin(box, trace_endpos);
setmodel(box, "maps/models/test1.bsp");
//Physic stuff
physics_enable(box, TRUE);
box.geomtype = GEOMTYPE_SOLID;
box.mass = 50;
box.massofs = box.origin;
box.forcetype = FORCETYPE_FORCE;
box.bouncefactor = 4;
break;
I was just plugging things in, trying to get something to happen with my test1.bsp(a box). However, the box just spawns in mid-air and doesn't move. What code to I have to use to get the object to work?
-

Mexicouger - Posts: 514
- Joined: Sat May 01, 2010 10:12 pm
Re: Using ODE physics? [Darkplaces]
I had a hard time getting ODE to work just 1 week ago so I think I can be of help here.
Ok, first of all compile yourself or find a dll for your windows/linux version of ode with double precision (I don't know why. It has to be double) and for Windows I had to rename it libode1.dll and put it in the main folder (together with the other .dlls).
Don't ask me why. If i leave it ode_double.dll (original name found in lib/ ode source folder) game doesn't use physics.
Here's mine.
Simple qc code to use a ball:
create an object in radiant with classname physobject_ball and you should be ok
let me know if it worked
PS: I noticed that writing something like this:
make the object stand still in the mid air
PPS: your youtube's qc tutorials are GREAT. I learned a lot! Next?
EDIT: to play a little, go to your PutClientInServer function and comment
and add this
now in PlayerPreThink function (client.qc file) add this:
Player walks as slow as an old turtle, when he stops he continues walking a little, when he felt from up he bounce like a rubber ball... but he can now play soccer!
Ok, first of all compile yourself or find a dll for your windows/linux version of ode with double precision (I don't know why. It has to be double) and for Windows I had to rename it libode1.dll and put it in the main folder (together with the other .dlls).
Don't ask me why. If i leave it ode_double.dll (original name found in lib/ ode source folder) game doesn't use physics.
Here's mine.
Simple qc code to use a ball:
- Code: Select all
void() AnimateItem=
{
physics_enable(self, 1);
};
void() physobject_ball {
setmodel(self, "models/phys/ball.iqm");
self.velocity = '0 0 0';
self.movetype = MOVETYPE_PHYSICS;
self.solid = SOLID_PHYSICS_SPHERE;
self.mass = 0.25;
self.bouncefactor = .4;
self.think = AnimateItem;
self.nextthink = time + 0.2;
};
create an object in radiant with classname physobject_ball and you should be ok
let me know if it worked
PS: I noticed that writing something like this:
- Code: Select all
self.origin_z = self.origin_z + 6;
make the object stand still in the mid air
PPS: your youtube's qc tutorials are GREAT. I learned a lot! Next?
EDIT: to play a little, go to your PutClientInServer function and comment
- Code: Select all
//self.solid = SOLID_SLIDEBOX;
//self.movetype = MOVETYPE_WALK;
and add this
- Code: Select all
//PLAYER ODE PHYSICS
self.geomtype = GEOMTYPE_CAPSULE;
self.movetype = MOVETYPE_PHYSICS;
self.bouncefactor = 0;
self.mass = 40;
now in PlayerPreThink function (client.qc file) add this:
- Code: Select all
physics_enable(self, 1);
Player walks as slow as an old turtle, when he stops he continues walking a little, when he felt from up he bounce like a rubber ball... but he can now play soccer!
Meadow Fun!! - my first commercial game, made with FTEQW game engine
- toneddu2000
- Posts: 1352
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
Re: Using ODE physics? [Darkplaces]
Hey thanks! I think all I needed was the .dll file. I wasn't aware that It was necessary. And no problem! Glad someone appreciated those videos(Though an incomplete series).
-

Mexicouger - Posts: 514
- Joined: Sat May 01, 2010 10:12 pm
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest