symek Posted June 16, 2007 Share Posted June 16, 2007 (edited) hi, Can anybody help me with this piece of code. I'd like to compute camera lookat vector from its position/rotation. There is mistake somewhere here but not sure where. Vector corespondes to my expectation but there is some error ie respect to camera position. set sx = `sin($RotX)`set cx = `cos($RotX)` set sy = `sin($RotY)` set cy = `cos($RotY)` set x = `$sy*$cx*` set y = `-$sx` set z = `$cy*$cx*` set lookat = `normalize(vector3($x, $y, $z))` echo $lookat thanks in advance! sy. EDIT: ok I did it like this: set lookat = normalize(vector3(0,0,-1) * (rotate($RX, "x") * rotate($RY, "y") * rotate($RZ, "z"))) BTW Am I wrong or hscript can not save matrix to variable? Above code doeasn't want to work divided into sections... only in one expression Edited June 17, 2007 by SYmek Quote Link to comment Share on other sites More sharing options...
Wolfwood Posted June 18, 2007 Share Posted June 18, 2007 (edited) hi,Can anybody help me with this piece of code. I'd like to compute camera lookat vector from its position/rotation. There is mistake somewhere here but not sure where. Vector corespondes to my expectation but there is some error ie respect to camera position. thanks in advance! sy. EDIT: ok I did it like this: BTW Am I wrong or hscript can not save matrix to variable? Above code doeasn't want to work divided into sections... only in one expression I posted a reply on the SESI forums. On a side note, there a couple of useful expression functions for dealing with look ats: mlookat(), mlookatup(), mobjlookat() and objlookat(). Edited June 18, 2007 by Wolfwood Quote Link to comment Share on other sites More sharing options...
symek Posted June 18, 2007 Author Share Posted June 18, 2007 Thanks again Wolfwood, I've checked all these expressions before my questions. Just I'm new at it (they need target coordinates to compute lookat vactor. This was something I didn't have or I couldn't get. Now problem is solved anyway!) cheers sy. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.