Welcome to od|forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

Noobini

VEXpression Presets

25 posts in this topic

Ground Zero: pretty obvious what this does....ie. no more bothering with getting the box's height then half it and move it up blah blah blah...just do this 'one' liner....

attribexpression/snippet
    Ground Zero
    @P;@P.y -= getbbox_min(0).y

 

Share this post


Link to post
Share on other sites

(Dirty) LookAt:

attribexpression/snippet
    Lookat 2nd Input
    (@P - getbbox_center(0)) * lookat(getbbox_center(1),getbbox_center(0)) + getbbox_center(0)

Why dirty ? coz it's manipulating points....not actually transforming the object

I used the Pighead as an easy object for illustration. By default, the pig is looking down on its Z axis...so if you are using a pointy object (ie. cone)...point your object down its Z axis first...

 

Edited by Noobini

Share this post


Link to post
Share on other sites

Align: (to bbox extremities)

(sorry for breaking the 'one line' rule...)

attribexpression/snippet
    Align
    @P;
    int alignaxis = chi("axis");
    float offset = ch("offset");
    if(alignaxis == 0){
        @P.y -= getbbox_min(0).y - offset;
    }
    else if(alignaxis == 1){
        @P.y -= getbbox_max(0).y - offset;
    }
    else if(alignaxis == 2){
        @P.x -= getbbox_min(0).x - offset;
    }
    else if(alignaxis == 3){
        @P.x -= getbbox_max(0).x - offset;
    }
    else if(alignaxis == 4){
        @P.z -= getbbox_min(0).z - offset;
    }
    else {
        @P.z -= getbbox_max(0).z - offset;
    }

 

Share this post


Link to post
Share on other sites

Stack:

attribexpression/snippet
    Stack
    @P;
    int stackaxis=chi("axis");
    float stackoffset=ch("offset");
    @P+=getbbox_center(1);
    if(stackaxis==0){
        @P.x+=getbbox_max(1).x-getbbox_center(1).x-getbbox_min(0).x+stackoffset;
    }
    else if(stackaxis==1){
        @P.y+=getbbox_max(1).y-getbbox_center(1).y-getbbox_min(0).y+stackoffset;
    }
    else{
        @P.z+=getbbox_max(1).z-getbbox_center(1).z-getbbox_min(0).z+stackoffset;
    }

 

Edited by Noobini

Share this post


Link to post
Share on other sites
On 29/6/2017 at 0:06 AM, Noobini said:

Collision Deform:
- 1st input - Geo to deform
- 2nd input - Collider


attribexpression/snippet
    Collision Deform
    length(@P-point(1,"P",nearpoint(1, @P)))<ch("dist")?lerp(@P,@P+@N,ch("deform")*chramp("lip",fit(length(@P-point(1,"P",nearpoint(1,@P))),0,1,0,1))*(1-length(@P-point(1,"P",nearpoint(1,@P))))):@P

 

 

CheapAssCollisionDeform.hipnc

DUDE YOU'RE  AWESOME!!!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now