Notifications
Clear all

[Closed] Inaccuracies in float_expression controller Vs float_script?

Hey all. I’ve just written a script to create a rig for a car engine. Well, just the crankshaft, pistons, conrods and valves at the moment. While trying to replace all possible script controllers with expression controllers, I’m having a strange issue where the expression controllers seem to be not as accurate as the script controllers. I usually make rigs with script controllers to start with cause they’re easier to read and easier to get feedback from while doing initial testing. But then I replace any script controllers that I can with expressions to make the rig run faster. But at the moment there seems to be a problem with some expressions not producing accurate results. If you create a rig with default values from both of these scripts, you can see that the pistonPoints don’t seem accurate from the 35 script.

Here are 2 links… the first one has the script that uses script controllers for the piston helpers, the second uses expressions.

https://dl.dropboxusercontent.com/u/6041120/CgRay-EngineRig_032.ms
https://dl.dropboxusercontent.com/u/6041120/CgRay-EngineRig_035.ms

Is this a bug or possibly a known thing? Or have I just messed up while converting the code?

Cheers,
Cg.

5 Replies
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

there is no and can not be any inaccuracy in expression calculation. the possible difference between a script and an expression can be:

using expressions you have to work in euler angles (with script you can do it in quaternions)

working separately with X,Y,Z rotation components you have to work in radians (in a script in degrees)

I think

The second occurrence of cylinderOffset doesn’t need the radToDeg() in the Engine_H_position point z position expression controller

((cos(radToDeg(driver)+CylinderOffset))*CrankRadius) + (sqrt((pow(conrodLength,2))-(pow((abs(sin(radToDeg(driver)+CylinderOffset)*CrankRadius)),2))))

Seems to get merged engines created by separate methods to behave the same way

Cheers

Mikie

Thank you, I’ll check it out when I get to work. After Dennis’ reply, I was thinking it was likely a radians vs degrees thing. I was going to check for any values that I hadn’t put radToDeg on rather than the other way around. Thanks, you likely saved me a lot of frustration.

Cheers,
Cg.

Yup, thanks. That was it.

Cg.

No Worries