dszs Posted March 13, 2015 Share Posted March 13, 2015 Hi guys, I have a vex based flocking system that was done in H11 and now I would like to migrate to H13, however I get a compliation when I ran it in H13: steerSolver:215:23-30: Error 1029: Invalid type in explicit cast: void to matrix steerSolver:215:32-37: Error 1066: No matching function for rotate(matrix; float; vector). Candidates are: void rotate(matrix3 &; float; vector), void rotate(matrix &; float; vector) steerSolver:216:31-33: Warning 2018: Using uninitialized variable: rot steerSolver:261:32-39: Error 1029: Invalid type in explicit cast: void to matrix steerSolver:261:41-46: Error 1066: No matching function for rotate(matrix; float; vector). Candidates are: void rotate(matrix3 &; float; vector), void rotate(matrix &; float; vector) steerSolver:263:43-47: Warning 2018: Using uninitialized variable: newUp steerSolver:269:9-20: Error 1066: No matching function for addattribute(string; vector; int). Candidates are: void addattribute(string; matrix3; ... ), void addattribute(string; matrix; ... ), void addattribute(string; float; ... ), void addattribute(string; int; ... ), void addattribute(string; vector4; ... ), void addattribute(string; string; ... ), void addattribute(string; vector; ... ), void addattribute(string; float[]; int; ... ) I tested it in H12.5 and it was working. Is there a major change in H13 that causes this? Thanks for taking your time to answer! -Darren Quote Link to comment Share on other sites More sharing options...
edward Posted March 14, 2015 Share Posted March 14, 2015 How do the offending lines look like? I think the type system in VEX has been made stricter, and some functions might have changed signatures slightly. Quote Link to comment Share on other sites More sharing options...
dszs Posted March 16, 2015 Author Share Posted March 16, 2015 Hi Edward, sorry for the late reply! Didn't have access to my code as it was in the office! The offending line looks like this : // contrain the turn angle in this simulation step float turnAngle = getAngleBetween(forward(), newVel); if (turnAngle > radians(maxTurn)) { turnAngle = radians(maxTurn); matrix identM = ident(); matrix rot = (matrix) rotate( identM, radians(maxTurn), axis); turnVel = forward() * rot; // new vel direction is turnVel //newVel = turnVel * length(newVel); } The weird thing is, in H12.5, it reports an error but it is still able to execute Quote Link to comment Share on other sites More sharing options...
rayman Posted March 16, 2015 Share Posted March 16, 2015 rotate() returns void, so try something like this: // contrain the turn angle in this simulation step float turnAngle = getAngleBetween(forward(), newVel); if (turnAngle > radians(maxTurn)) { turnAngle = radians(maxTurn); matrix identM = ident(); rotate( identM, radians(maxTurn), axis); turnVel = forward() * identM; // new vel direction is turnVel //newVel = turnVel * length(newVel); } Quote Link to comment Share on other sites More sharing options...
dszs Posted March 16, 2015 Author Share Posted March 16, 2015 (edited) Hi rayman, it works! Thanks. Can I ask another question? There is another section which have the same problem. I already tried with the above method but it still returns the same error vector newUp = up() * rotate(upRot, turnAngle, forward()); //vector newUp = up() + steer * (1-upInertia); newUp = (targetUp * (upInertia) + newUp ) / 2; setUp( cross(cross( forward(), newUp ), forward()) ); vector heading = {0,0,0}; //import("heading", heading, 0); heading = normalize( (normalize(oldForward) + turnVel) / 2 ); addattribute("heading", heading, 0); } Is there something I did wrong? Edited March 16, 2015 by dszs Quote Link to comment Share on other sites More sharing options...
magneto Posted March 16, 2015 Share Posted March 16, 2015 It means return "nothing" http://en.wikipedia.org/wiki/Void_type Quote Link to comment Share on other sites More sharing options...
dszs Posted March 16, 2015 Author Share Posted March 16, 2015 Ahhh thanks Ryan, that explains why it didn't work Quote Link to comment Share on other sites More sharing options...
dszs Posted March 16, 2015 Author Share Posted March 16, 2015 Ah nvm! I found out the mistake I made alr. I should have let the rotate modify the matrix before letting it modified matrix multiply with the up(). Thanks guy for your help! 1 Quote Link to comment Share on other sites More sharing options...
lhgou11 Posted October 7, 2015 Share Posted October 7, 2015 Hi Dszs !! I also met the same problem , I still confuse why the code cannot be compiled, could you paste the result you have modified of this part: Quote Link to comment Share on other sites More sharing options...
fathom Posted October 13, 2015 Share Posted October 13, 2015 rotate doesn't return a value, it updates the matrix you supply as the first value. you need to split up that line to first rotate your matrix and then multiply your up vector by your rotated matrix. rotate(upRot, turnAngle, forward()); vector newUp = up() * upRot; Quote Link to comment Share on other sites More sharing options...
dszs Posted October 31, 2015 Author Share Posted October 31, 2015 Hi Dszs !! I also met the same problem , I still confuse why the code cannot be compiled, could you paste the result you have modified of this part: QQ图片20151007181426.png Hi, Sorry for the late reply! Hope it's not too late to clarify stuff. I don't have the original code anymore. But what fathom mentioned is exactly what you should be doing rotate doesn't return a value, it updates the matrix you supply as the first value. you need to split up that line to first rotate your matrix and then multiply your up vector by your rotated matrix. rotate(upRot, turnAngle, forward()); vector newUp = up() * upRot; - Darren 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.