Shanjaq / uhexen2

GitHub clone of SVN repo svn://svn.code.sf.net/p/uhexen2/code/trunk (cloned by http://svn2github.com/)
12 stars 1 forks source link

[Just for fun] Dynamic origin change #62

Open Inky-Inky opened 3 years ago

Inky-Inky commented 3 years ago

The setorigin function is used to change an entity's location in the world. It works not only with point entities but with brush entities as well. Here is its code:

void PF_setorigin (void)
{
    edict_t *e;
    float   *org;

    e = G_EDICT(OFS_PARM0);
    org = G_VECTOR(OFS_PARM1);
    VectorCopy (org, e->v.origin);
    SV_LinkEdict (e, false);
}

If my understanding is correct, VectorCopy sets the new position, then SV_LinkEdict applies the offset to all the brushes making the entity to have the whole thing move to its new location.

I wonder what a PF_setorigin2 duplicate of this function without the last line would do... Would it keep a brush entity visually at the same location while only moving the logical coordinates used as a reference for rotations? If so, I'm pretty sure it would open a new range of possibilities for fancy dynamically changing moves...

That's not really a feature request but more of a theoretical "what if...?" thought. And maybe it's not even how things work and my post is totally pointless. Now of course, I'm in to help testing if ever you feel like giving its chance to this weird idea and it ends up being something doable. :-D

Inky-Inky commented 3 years ago

The setorigin function is used to change an entity's location in the world. It works not only with point entities but with brush entities as well. Here is its code:

void PF_setorigin (void)
{
    edict_t *e;
    float   *org;

    e = G_EDICT(OFS_PARM0);
    org = G_VECTOR(OFS_PARM1);
    VectorCopy (org, e->v.origin);
    SV_LinkEdict (e, false);
}

If my understanding is correct, VectorCopy sets the new position, then SV_LinkEdict applies the offset to all the entity's brushes to have the whole thing move to its new location.

I wonder what a PF_setorigin2 duplicate of this function without the last line would do... Would it keep a brush entity visually at the same location while only moving the logical coordinates used as a reference for rotations? If so, I'm pretty sure it would open a new range of possibilities for fancy dynamically changing moves...

I'm not sure it's how things work actually so the first part of my post may be totally irrelevant, but anyways what I ultimately aim at doing is being able to have complex or sequenced rotations for func_trains whose origin point is not fixed relatively to the entity box but can be adjusted over time. Trains could rotate around a central point and/then spinning around themselves, doors open like garage doors (if that makes sense), etc. More freedom of movement anyways.

Of course, I'm in to help testing if ever you feel like giving its chance to this weird idea and it ends up being something doable. :-D