#### lingrenddd

• Newbie
• Posts: 20
« on: March 03, 2022, 07:59:10 PM »
I want to do a parking lot, I want the head of the head to change the random mirror, there is also a variation. But when I use Cars Alone Spline special effects, I always have a strange effect (car chaos). Later, I optimized the car model and decreased the number, and then picked up the found effect than before, I didn't understand this phenomenon. The A Series in the file is a car that optimizes the number of faces, and the V-series is a car that is not optimized. Please help me check out what is going on, where is the problem, and it is to do a large-scale parking lot. Which is the best way, thank you! I will upload the file to WETRANSFER and inform Helpdesk@itoosoft.com, please pay attention to check.

#### Michal Karmazín

• iToo Software
• Hero Member
• Posts: 1813
« Reply #1 on: March 04, 2022, 09:19:49 AM »
Hi,

Thanks for the provided scene. Well, this effect is written to be used with "side splines" and it "shifts" the position of these cars automatically (by using the collision radius of the item). In case you would like to use a "centerline", it should be modified a bit (the collision radius should be removed). It may look like the following:

Code: [Select]
`## translate X Y along item's local normal ##real angle = fpItem.rotation.z;fpItem.rotation.z =fpItem.rotation.z + if(randomInt(0,randomiseParkDirection)==1,degtorad(180),0);real randomOffsetX = randomInt(xoffsetStart,xoffsetEnd);real randomOffsetY = randomInt(YoffsetStart,YoffsetEnd);vector position = [cos(angle)*randomoffsetX, sin(angle)*randomoffsetX,0];position = position + [cos(angle-degtorad(90))*(randomOffsetY), sin(angle-degtorad(90))*(randomOffsetY),0];fpItem.position = if(switchSides==0,fpItem.position+position, fpItem.position-position);int spaceProbability = randomInt(1,100);fpItem.visible = if(emptySpaces >= spaceProbability,0,1);##project onto surface in new positionfpItem.position.z =  fpSurfaceHitZ(fpItem.position);## Align to surface at new position.vector v = unit(fpSurfaceHitNormal(fpItem.position));vector v3 = unit(crossprod(fpItem.yrotaxis,v));vector v2 = crossprod(v,v3);fpItem.xrotaxis = v3;fpItem.yrotaxis = v2;fpItem.zrotaxis = v;`
I hope that clears it up and in case of any further question(s) or doubt(s), please don't hesitate to contact us. Have a great day.

Best regards,

• Newbie
• Posts: 20