Rotation
by Morrock · in Technical Issues · 10/25/2007 (6:37 pm) · 7 replies
Does anyone know how to rotate one vertex around another? A function, command or equation I can use?
About the author
#2
11/01/2007 (3:05 am)
I think your question lacks context. Without knowing that, it's real hard to answer except in some random, abstract way. In a way, it appears you answered your own question.
#3
Its a perfectly valid question and he provided wonderful context in the second post.
I *think* this might do it, but I'm no expert.
11/01/2007 (4:10 am)
What the heck are you talking about Lee?Its a perfectly valid question and he provided wonderful context in the second post.
I *think* this might do it, but I'm no expert.
// axis and angle rotation %rot = "0 0 1" SPC mDegToRad(90); // rotate 90 degress around Z axis %mat = MatrixCreate(%start, %rot); %endInObjectSpace = VectorSub(%end, %start); %endInObjectSpace = MatrixMulPoint(%mat, %endInObjectSpace); %end = VectorAdd(%endInObjectSpace, %start);
#4
11/01/2007 (9:48 am)
Does torque suport vertexes? I thought it only supported skeletons?
#5
Is he talking about vertex animation, as TedHehdjehki wonders? Vertex shader? General 3d programming? Who knows. It's hard to get help when you're questions are vague--I'm actually trying to be helpful.
11/01/2007 (12:27 pm)
@Brain: seeing as how this group is General Technical Issues For Game Developers >> Programming, we cannot know if he's talking about Torquescript or not. Since I know that TS doesn't support what he wants to do, in particular. You've provided a nice rotation algorithm, though :)Is he talking about vertex animation, as TedHehdjehki wonders? Vertex shader? General 3d programming? Who knows. It's hard to get help when you're questions are vague--I'm actually trying to be helpful.
#6
ex: "5 2 0" around "7 8 3" but just in 2 dimensions, so more like "5 2" around "7 8".
I'll try out your code Brian, thankyou for the help.
11/01/2007 (2:30 pm)
Sorry, I meant to say vectors, or at least that better be the right term. My stupid mistake, I see what you guys mean. No I just want to get one coordinate (tri-ordinate?) and rotate it around another inside the game world. ex: "5 2 0" around "7 8 3" but just in 2 dimensions, so more like "5 2" around "7 8".
I'll try out your code Brian, thankyou for the help.
#7
11/01/2007 (4:31 pm)
@Lee, well he is using Torque Script variables (see the %'s in his first post) and Torque Script does support what he wants to do (as I showed above).
Torque 3D Owner Morrock
%start
%end
%end = %end(rotate 90 around %start)