issue between reflect VEX function and VOP node

   1798   2   0
User Avatar
Member
34 posts
Joined: Sept. 2013
Offline
Hi ,

I am trying to convert a basic VOP setup to VEX and I am facing some differences in the output using reflect as VOP node,and while used as a VEX function,In the attached file Reflect in VOP is causing the object to change direction smoothly based on the force used after hitting the ground where as in VEX the change is sped up and object in not reaching to the ground,Not sure where I went wrong.

Attachments:
BouncingBall.hip (154.8 KB)

User Avatar
Member
8177 posts
Joined: Sept. 2011
Offline
There were two issues with your vex code.

  1. The non-reflect state was adding the force to the existing force, whereas in the attribvop, it was passing through unchanged.
  2. The if statement's actions were the reverse of how it was in the attribvop.

Here is a fixed version of the code:

// Explicit prototypes
vector @P;
export vector @force;
float @radius;

int switch = @P.y <= @radius;
vector dir = @force;
vector nml = set(0,1,0);
vector rdir = reflect(dir, nml);

@force = select(switch, rdir, dir);
User Avatar
Member
34 posts
Joined: Sept. 2013
Offline
jsmack
There were two issues with your vex code.

  1. The non-reflect state was adding the force to the existing force, whereas in the attribvop, it was passing through unchanged.
  2. The if statement's actions were the reverse of how it was in the attribvop.

Here is a fixed version of the code:

// Explicit prototypes
vector @P;
export vector @force;
float @radius;

int switch = @P.y <= @radius;
vector dir = @force;
vector nml = set(0,1,0);
vector rdir = reflect(dir, nml);

@force = select(switch, rdir, dir);


thanks alot jsmack,that makes sense and works
  • Quick Links