Forum

Pendulum physics

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Pendulum physics

Postby Nahuel » Mon Aug 29, 2011 10:30 pm

hello to all!!
is it possible to make something like physics of a pendulum? I do not speak about the Rogue pendulum, i want a "realistic" pendulum :D.
I made a few destroyable light bulbs with rt_lights for darkplaces. But I want to add physics to the bulbs. it is possible? can anybody give me any suggestion?
Check my video-test of the lights (sorry for the sound and the CS S model :oops: it´s just a test) http://www.youtube.com/watch?v=scCLaEbS-mw
hi, I am nahuel, I love quake and qc.
User avatar
Nahuel
 
Posts: 492
Joined: Wed Jan 12, 2011 8:42 pm
Location: mar del plata

Postby thorn3001 » Mon Aug 29, 2011 11:54 pm

Hello!

Do you will make something like this?

http://www.youtube.com/watch?v=51DSDtnoPVg

it seem very difficult, maybe on Darkplaces engine
Thorn
User avatar
thorn3001
 
Posts: 29
Joined: Tue Jun 28, 2011 6:09 am
Location: Bogotá, Col

Re: Pendulum physics

Postby frag.machine » Mon Aug 29, 2011 11:54 pm

Nahuel wrote:hello to all!!
is it possible to make something like physics of a pendulum? I do not speak about the Rogue pendulum, i want a "realistic" pendulum :D.
I made a few destroyable light bulbs with rt_lights for darkplaces. But I want to add physics to the bulbs. it is possible? can anybody give me any suggestion?
Check my video-test of the lights (sorry for the sound and the CS S model :oops: it´s just a test) http://www.youtube.com/watch?v=scCLaEbS-mw


IIRC the RMQ grappling hook has it.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2090
Joined: Sat Nov 25, 2006 1:49 pm

Postby toneddu2000 » Tue Aug 30, 2011 6:54 am

Wow, wonderful demo Nahuel, as always! You (maybe) could use Ode to make a pendulum with hinges, IIRC. But my question is: after you make it, how do you think to attach dynamic lights to it?
toneddu2000
 
Posts: 1352
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

gb

Postby goldenboy » Tue Aug 30, 2011 10:20 am

rope physics? I think Necros experimented with ropes in Quake, ask him. Unless my memory is failing me.

The RMQ grapple allows the player to dangle and swing from the grapple line, yeah, but no idea how helpful the code is for making dangling light bulbs. It has nothing to do with physics, really.

If you find a solution, do post it, I'd like to know ^^
User avatar
goldenboy
 
Posts: 924
Joined: Fri Sep 05, 2008 11:04 pm
Location: Kiel

Postby Nahuel » Tue Aug 30, 2011 7:00 pm

toneddu2000 wrote:Wow, wonderful demo Nahuel, as always! You (maybe) could use Ode to make a pendulum with hinges, IIRC. But my question is: after you make it, how do you think to attach dynamic lights to it?

I use PFLAGS_. These lights can move, :D
If you want here you can download my lights, :( :( i do not use some "DP features" like "style" or "skin". Check the source, all you need is in "rtlights.qc". I included the map of the video "rtest"
http://www.mediafire.com/?244msx05jmytrjt

goldenboy wrote:rope physics? I think Necros experimented with ropes in Quake, ask him. Unless my memory is failing me.

The RMQ grapple allows the player to dangle and swing from the grapple line, yeah, but no idea how helpful the code is for making dangling light bulbs. It has nothing to do with physics, really.

If you find a solution, do post it, I'd like to know ^^

If you say it!! I will ask! i think that the rope physics are not imposible !!! :D
hi, I am nahuel, I love quake and qc.
User avatar
Nahuel
 
Posts: 492
Joined: Wed Jan 12, 2011 8:42 pm
Location: mar del plata

Postby toneddu2000 » Wed Aug 31, 2011 11:18 am

wow, thanks a lot Nahuel! It's a very interesting technique. I like very much the light break effect

EDIT: can you please explain how PFLAGS variables work(or post a link where they are described)?I noticed that the're used a lot in darkplaces c code (cl_main.c, cl_parse.c,clvm_cmds.c,protocol.h,r_shadow.c,sv_main.c and sv_phys.c)and I presume they need for dynamic light computation but I can't get how to use them and why
toneddu2000
 
Posts: 1352
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Postby necros » Thu Sep 01, 2011 6:35 am

i've tried a couple of seperate ways to do it, but the results are not 100%.

you can see it in action here:
http://www.youtube.com/watch?v=21D-21MLrAE

currently, the video i linked uses the .velocity method:

essentially, what is done, is you build the rope out of a chain of seperate entities. it's a good idea to provide 31 frames, a frame for when the rope segment is 1 unit long, 2, 3... up to 32 units long.

next, use an engine with higher precision angles (DP, RMQe, QBism's 8Bit Engine to name a few).
low precision angles will make the rope segments align badly and make it really obvious your rope is just made out of small pieces.

next, you need to first figure out and set the start and end of the rope to movetype_none.

from there, you iterate through the rope, adding velocity to each segment both to the previous rope segement and the next. you're essentially creating a 'real time' solver.

problems: if your engine, for whatever reason, gets low frame rate, the velocities required to keep the rope together grow increasingly higher. eventually, the rope can shatter to pieces if your code deems it necessary to apply 10000 u/sec to a segment.
you can add velocity limits, of course, but then your rope just falls apart at low framerate.

btw, the 'shivers' you see are when fraps caused a sudden dip in framerate. this was an earlier version that only interated once, and set segment angles at the same time it was adding velocity.
by interating twice, once to add velocities, and again to correct angles, you can get rid of this.

finally, the main problem, and the reason i never really bothered trying very hard to get this going, is it takes up massive amounts of QC time. A medium sized rope might have 16 or more segments, and the velocity and angles iterations must be done every frame.
it's just not feasible because it's almost always going to be active.

the second method i tried, was setting origin directly. this has the advantage of not being framerate dependant and being detached from the physics engine.

however, this also means you don't get basic things like collision necessitating extra traceline checks and possibly pointcontent checks to try to simulate collision in QC.

and this is only for the simplest rope: single rope connected to on both ends.
dangling ropes with a weight attached is probably much worse because now you've got momentum and angular momentum and oh my god my head exploded.


i would be interested in knowing how you made your directional flash light though. looks just like the d3 flashlight!
necros
 
Posts: 77
Joined: Thu Dec 16, 2004 10:32 pm

Postby toneddu2000 » Thu Sep 01, 2011 7:16 am

Oh, my god! :shock: Ropes in quake! I never thought it was possible! Great technique, compliments!
toneddu2000
 
Posts: 1352
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Postby goldenboy » Thu Sep 01, 2011 8:17 am

Is that a texture for the flashlight?
User avatar
goldenboy
 
Posts: 924
Joined: Fri Sep 05, 2008 11:04 pm
Location: Kiel

Postby Seven » Thu Sep 01, 2011 12:14 pm

First of all I must say:
You make AMAZING things, Nahuel and Necros !!!

Regarding Nahuel´s flashlight:
I think he made it via a cubemap, right ? ;)
This is the thread, with his first version (if I am not mistaken):
viewtopic.php?t=3451

Please keep on doing the wonderful things you do guys.

Best wishes,
Seven
Seven
 
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany

Postby goldenboy » Thu Sep 01, 2011 1:17 pm

I see. Very nice.
User avatar
goldenboy
 
Posts: 924
Joined: Fri Sep 05, 2008 11:04 pm
Location: Kiel

Postby necros » Thu Sep 01, 2011 6:45 pm

interesting... checked out the qc for the link you gave above.

something in there called pflags which i guess is a DP specific flag set. i'll have to experiment with that i guess.
necros
 
Posts: 77
Joined: Thu Dec 16, 2004 10:32 pm

Postby OneManClan » Fri Sep 02, 2011 12:59 am

toneddu2000 wrote:Oh, my god! :shock: Ropes in quake! I never thought it was possible! Great technique, compliments!

+1 .... amazing!
OneManClan
 
Posts: 243
Joined: Sat Feb 28, 2009 2:38 pm

Postby Nahuel » Fri Sep 02, 2011 1:57 pm

[quote="necros"][/quote]
incredible rope necros!!!!!! what think of that only I used 2 segments? bony a segmentp as origin (in the roof with MOVETYPE_NONE) and other would be the light bulb. or Perhaps it would be better to use 3 segments.........
-------------------------------------------
segment 0-------roof
segment 1
|
|
|
|
segment 2 (light bulb)
----------------------------------------------
Maybee the "pain" of the entity light might be the "velocity increase" and the angles based on the origin of the attacker....
:?: :?:
What do you think about that? Might it be possible?? or is it a foolery? can two separated entities be segments of the same rope?? or does not it treat about another thing?
I am lost with this :lol:
------------------------------------------------------------------------------
i am using the cubemap of the flashlight of d3 :oops: in this thread http://forums.inside3d.com/viewtopic.php?t=4274
the early flashlight is some ugly :), otherwise these flashlight can not be perfect, i have problems with the shadow of the player
I use this "fixed" code now
Code: Select all
void() flash_update =
{
        if (self.owner.deadflag != DEAD_NO)
                return;
if (self.owner.classname != "player")
      return;
        makevectors (self.owner.v_angle);
        traceline (self.owner.origin , (self.owner.origin+(v_forward * 10)), FALSE , self);
        setorigin (self, trace_endpos+ '0 0 16' );//+(v_forward * - 6));
self.angles_x = (((self.owner.angles_x) * - 3) - 180);
self.angles_y = self.owner.angles_y - 3 ;
self.angles_z = self.owner.angles_z;
self.pflags = PFLAGS_FULLDYNAMIC;
   self.light_lev = 1950;
   self.color = '1 1 1';
   self.skin = 200; 
   self.scale = 15; 

        self.nextthink = time + 0.002;


};

void() flash_on =
{
           local entity myflash;

        myflash = spawn ();
        myflash.movetype = MOVETYPE_NONE;
        myflash.solid = SOLID_NOT;
             setmodel (myflash, "progs/nada.spr");
        setsize (myflash, '0 0 0', '0 0 0');


        myflash.owner = self;
        self.flash = myflash;
       

        myflash.classname = "flash";
       
        makevectors (self.v_angle);
traceline (self.owner.origin , (self.owner.origin+(v_forward * 10)), FALSE , self);

        setorigin (myflash, trace_endpos);


        myflash.think = flash_update;
        myflash.nextthink = time + 0.002;

};


void () flash_toggle =
{


        if (self.flash_flag == FALSE)
        {       
                self.flash_flag = TRUE;
                flash_on();
   sound (self, CHAN_WEAPON, "misc/click.wav", 1, ATTN_NORM);   

        }

        else
        {
                self.flash_flag = FALSE;
                W_SetCurrentAmmo ();
                self.flash.think = SUB_Remove;
                self.flash.nextthink = time + 0.1;
   sound (self, CHAN_WEAPON, "misc/clickoff.wav", 1, ATTN_NORM);   

        }


};

and i modified the tga; a big chanel alpha with a little image inside you can download the correct size (example) here
http://www.mediafire.com/?i9sm5c047cq59wn (no copyright problems with this tga :oops:)
Yes!!!!!!! i am using the tenebrae of darkplaces it is great!!!!!!! :D :D
hi, I am nahuel, I love quake and qc.
User avatar
Nahuel
 
Posts: 492
Joined: Wed Jan 12, 2011 8:42 pm
Location: mar del plata

Next

Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest