How do I get entity centerpoint in QC? (not origin)

Developer discussion of experimental fixes, changes, and improvements.

Moderators: Nexuiz Moderators, Moderators


  • How do I get entity centerpoint in QC? (not origin)
    How do I figure out if the origin is comming up as 0,0,0 (or nothing and it's using the map origin instead)?

    I want to make the debris launch from entity center point if no origin was set.
    I need to find out the entity's center to do this, and I need to know if it doesn't have an origin.
    I guess I will assume there is no origin if the origin comes up as 0 0 0 (but what is the if/then for this? if (self.orgin == '0 0 0')?

    is abs min/max it?

    Code: Select all
    void LaunchDebris (string debrisname) =
    {
       local   entity dbr;

       dbr = spawn();
       dbr.origin = self.origin + self.absmin
                  + '1 0 0' * random() * (self.absmax_x - self.absmin_x)
                  + '0 1 0' * random() * (self.absmax_y - self.absmin_y)
                  + '0 0 1' * random() * (self.absmax_z - self.absmin_z);
       setmodel (dbr, debrisname );
       dbr.movetype = MOVETYPE_BOUNCE;
       dbr.solid = SOLID_NOT;
       // TODO parametrize this
       dbr.velocity_x = 70 * crandom();
       dbr.velocity_y = 70 * crandom();
       dbr.velocity_z = 140 + 70 * random();
       dbr.avelocity_x = random()*600;
       dbr.avelocity_y = random()*600;
       dbr.avelocity_z = random()*600;
       SUB_SetFade(dbr, time + 1 + random() * 5, 1);
    };
    tundramagi
    Forum addon
     
    Posts: 974
    Joined: Sun Jan 04, 2009 4:53 pm

Tue Apr 28, 2009 2:16 pm

  • try with

    Code: Select all
    e.origin + (e.mins + e.maxs) * 0.5


    why another thread? you just had to press the new topic button, right?
    User avatar
    mand1nga
    Alien trapper
     
    Posts: 321
    Joined: Mon May 12, 2008 12:19 am

Tue Apr 28, 2009 6:05 pm

  • mand1nga wrote:try with

    Code: Select all
    e.origin + (e.mins + e.maxs) * 0.5


    why another thread? you just had to press the new topic button, right?


    Doesn't work. Can I have another way? This is what I tried (it still drops from origin):

    dbr.origin = (self.origin + (self.mins + self.maxs) * 0.5)
    + '1 0 0' * random() * (self.absmax_x - self.absmin_x)
    + '0 1 0' * random() * (self.absmax_y - self.absmin_y)
    + '0 0 1' * random() * (self.absmax_z - self.absmin_z);

    Why in QC is nothing easy and everything impossible?
    tundramagi
    Forum addon
     
    Posts: 974
    Joined: Sun Jan 04, 2009 4:53 pm



Return to Nexuiz - Development




Information
  • Who is online
  • Users browsing this forum: No registered users and 1 guest