View Full Version : dealing with Normal Vector
jiyongman 02222011, 12:26 AM dealing with Normal Vector.
Hey guys,
I got one Normalized Normal Vector(Average) << 0.47548, 0.80906, 0.345457 >> using polyNormalPerVertex command.
I want rotation values from the above to match an object's rotation.
Someone told me I could do it using acos, and asin after projecting on a plane, but I don't understand what it means.
Could anyone expain this specifically? (of course, an example will help a lot!!
For your information, I'm really bad at math)
Or, are there any other ideas to accomplish what I want??


mduvekot
02222011, 01:46 AM
Lookup the angleBetween command. You give it two vectors (the normal and a reference like <<0,1,0>> and if you use the euler flag, it will give you the euler angles that you need.
For example; thhe angle between the yaxis and xaxis
angleBetween euler v1 0.0 1.0 0.0 v2 1.0 0.0 0.0;
// Result: 0 0 90 //
ewerybody
02222011, 01:53 AM
but you know basic trigonometry (http://en.wikipedia.org/wiki/Trigonometric_functions)?
On Khan academy (http://youtu.be/F21S9Wpi0y8) its cool too!
Projecting on a plane is looking at only 2 components of a 3 component vector.
ewerybody
02222011, 01:55 AM
or the easy way... :D
jiyongman
02222011, 04:48 AM
Lookup the angleBetween command. You give it two vectors (the normal and a reference like <<0,1,0>> and if you use the euler flag, it will give you the euler angles that you need.
For example; thhe angle between the yaxis and xaxis
angleBetween euler v1 0.0 1.0 0.0 v2 1.0 0.0 0.0;
// Result: 0 0 90 //
ewerybody, it's very very good information!!! I bookmarked it right away :)
you know, in the article I first wrote yesterday, I mentioned 'some guys' there, one of them was you. haha!
Thank you mduvekot, I guess you are also very professional guy(I visisted your site:)).
I have a question!
What if I can get only one vector?
As you know, maya commands like 'polyInfo fn' return only one normal and I can use the only clue as a direction information.
Do I just put there <<1 0 0>> as a reference regardless of the status in the scene file??
And one other question!
As far as I know, one normal vector doesn't include the status of a transform node.
It's like an information of a shape node.
What do I do next, if I get the correct eular angle with your help?
The conditions I'm worried are like this.
The object is scaled in one axis.
And the object's pivot is moved.
Then the object is rotated.
Finally the object's all channels are freezed.
How do I apply the exact rotation to the other object?
I want to make a script which puts an object on a certain face of a target object, following the target face's direction.
mduvekot
02222011, 01:36 PM
I want to make a script which puts an object on a certain face of a target object, following the target face's direction.
Then there is no need to build the tools yourself, since Maya has them already. The easy way is to use a normal constraint. See User Guide > Rigging > Character Setup > Constraints > Normal constraint > Normal constraints
jiyongman
02242011, 12:59 AM
Then there is no need to build the tools yourself, since Maya has them already. The easy way is to use a normal constraint. See User Guide > Rigging > Character Setup > Constraints > Normal constraint > Normal constraints
in fact, it's not that important that there's a tool or script already, you know.
This was like kind of an assignment by myself to improve my scripting skill rather than making a tool I need. (and faced difficulty soon ;))
I'm not still a good mel scripter but it's been years since I first made my own one.
So far, I utilized maya's functions a lot (deleting, filtering some of the results of it after applying, you know:)) which helped me with special fuctions with less codes.
But recently I started to try not to use them if possible.
To be a good scripter, I think I need my own codes more not relying on maya's functions.
Of course, I know that sometimes there's no solution at all without maya's fuctions such as capturing the view port screen.
(As we know we need to use playblast command in this case~)
Anyway, I tried normal constraint refering to your idea, thanks, but failed TT
That function can't be applied to FACES but to objects only.
Am I missing something here?
CGTalk Moderation
02242011, 12:59 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©20002015, Jelsoft Enterprises Ltd.