Daz script sin() and cos() functions

I've started playing with scripts. What I want to do is rotate an object - that bit I've got working (i.e. writing different Xrot values to successive frames). But it rotates about the bottom of the object, rather than its centre - so I've got to apply deltas to the Y and Z transforms to correct the apparant centre of rotation - and for that I need to use sin() and cos(). Except I get a runtime error "ReferenceError: Can't find variable: sin". So I assume I haven't understood the syntax correctly. I have the angle in radians in a DzVec3 variable (x, y, z) called ang (ang.x is limited to +/- PI), and the line which throws the error is as follows:

var deltaY = -(217 * sin(ang.x));

(217 being the distance from the base of the object being rotated to my required centre of rotation).

 

Post edited by Richard Haseltine on

Comments

Sign In or Register to comment.