Integrating 3D models with photography
Interested in integrating your 3D work with the real world? This might help
# 1 04-08-2012 , 02:37 PM
dustykhan's Avatar
Subscriber
Join Date: Apr 2012
Posts: 187

// Error: An execution error occurred in the creation expression... SOLVED

I am using the expression below but I get this error when I run it I get this: // Error: An execution error occurred in the creation expression for particleShape1. does anybody know what could be causing this or a way to fix it...?

particleShape1.aimUp = <<0,1,0>>;

particleShape1.randomRotationY = rand(360);

vector $p = particleShape1.position;
vector $normal = `nearestPointOnMesh -ip ($p.x) ($p.y) ($p.z) -normal -q pPlane1`;

particleShape1.aimDir = $normal;

float $rotx = rad_to_deg( atan2( ($normal.z), ($normal.y) ) );
float $rotz = rad_to_deg( asin( -($normal.x) ) );

particleShape1.rotationPP = << $rotx, particleShape1.randomRotationY, $rotz >>;

particleShape1.customIndex = 0;


Last edited by dustykhan; 05-08-2012 at 12:07 PM.
# 2 04-08-2012 , 07:20 PM
NextDesign's Avatar
Technical Director
Join Date: Feb 2004
Posts: 2,988
It means that you have a syntax error somewhere in it. Comment out the entire thing, then one-by-one, uncomment each line, and see where it breaks.


Imagination is more important than knowledge.
# 3 04-08-2012 , 07:48 PM
dustykhan's Avatar
Subscriber
Join Date: Apr 2012
Posts: 187
Thanks for the response the line causing the error seems to be below, but im not sure what is wrong, or how to correct it :S any ideas?

vector $normal = `nearestPointOnMesh -ip ($p.x) ($p.y) ($p.z) -normal -q pPlane1`;

# 4 05-08-2012 , 01:59 AM
NextDesign's Avatar
Technical Director
Join Date: Feb 2004
Posts: 2,988
Make sure that you have the nearestPointOnMesh plugin loaded.


Imagination is more important than knowledge.
# 5 05-08-2012 , 09:11 AM
dustykhan's Avatar
Subscriber
Join Date: Apr 2012
Posts: 187
Ahhhh I feel so stupid now user added image thank you the problem is now sorted !

# 6 03-03-2015 , 06:41 PM
Registered User
Join Date: Feb 2015
Posts: 3
Hi i have also same error and my expressions are right .i added all the expressions step by step as you said and there is no error but, when i play for particles i again got same error .My plugin is also on.I would be thanks full to you for help.Thanks


// sets the orient axis for the instace
particleShape1.aimUp = <<0,1,0>>;

//random rotation for Y axis
particleShape1.randomRotationY = rand(360);

// get surface normal at particle position
vector $p = particleShape1.position;
vector $normal = `nearestpointonMesh -ip ($p.x) ($p.y) ($p.z) -normal -q pPlane1`;

// orient the instance
particleShape1.aimDir = $normal;

// solve each angle, convert to degrees
float $rotX = rad_to_deg( atan2( ($normal.z), ($normal.y) ) );
float $rotz = rad_to_deg( atan2( ($normal.x) ) );

// assign random rotation in Y
particleShape1.rotationPP = << $rotX, particleShape1.randomRotationY, $rotz >>;

# 7 03-03-2015 , 06:54 PM
Registered User
Join Date: Feb 2015
Posts: 3
I have also same error .I added all the expressions step by step as you said and didn't get any error, fortunately my expression are right .But when i play for particles i again got error. // Error: An execution error occurred in the creation expression for particleShape1.
My plugin is also On. below is expression which i am using.

// sets the orient axis for the instace
particleShape1.aimUp = <<0,1,0>>;

//random rotation for Y axis
particleShape1.randomRotationY = rand(360);

// get surface normal at particle position
vector $p = particleShape1.position;
vector $normal = `nearestpointonMesh -ip ($p.x) ($p.y) ($p.z) -normal -q pPlane1`;

// orient the instance
particleShape1.aimDir = $normal;

// solve each angle, convert to degrees
float $rotX = rad_to_deg( atan2( ($normal.z), ($normal.y) ) );
float $rotz = rad_to_deg( atan2( ($normal.x) ) );

// assign random rotation in Y
particleShape1.rotationPP = << $rotX, particleShape1.randomRotationY, $rotz >>;

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads