Pages

Friday 18 January 2013

It's amazing what you can access in the hypershade

Not found a use for this yet but someone might......

Found a way to access the tangent of the curve at a given edit point. I'm sure there might be another way but it goes to show that it is possible to access all kinds of things and by having a little play and looking at how things connect.

Draw a CV curve (quadratic)
Get a locator

Open either the node editor or the hypershade (I'll be using the node editor)

In the attribute editor turn on the Disp EP in the component display so that you can see the edit points.

If you expand the curve shape in the node editor you will only see one edit point, this is a glitch in maya. To be able to access other edit points all you need to do is connect the output of the edit point to something (such as the translate of the locator) and another one will appear. Bear in mind it will add access to another edit point each time you connect the last available edit point, even if there are not any more edit points on the curve. e.g. I have 4 edit points but when I connect something to edit point [3]; the last one. I get access to edit point [4] which doesn't exist on the curve, another glitch.

Connect the curve shape -edit point[1] to the transform of the locator. In the viewport you will see the locator is now snapped to the edit point.

Now to access the tangent at that point we need another node. In the mel script box (bottom left) type
createNode motionPath
This is the same node created if you are animating an object along a path.

 You'll need the connection editor for the next bit as the connections you need are not in the node editor.
Connect the world space of the curve shape to the geometry path of the motion path node.





Then to apply the tangent to the locator, connect the rotate from the motion path to the rotate of the locator.

In the attribute editor have a look at the motion path node.
The u-value lets you decide the tangent that you want (each edit point has a whole number value starting at 0) in my case I have my locator tied to the second edit point so I set the u value to 1. You can also use these attributes to decide which axis to point down the tangent.
If you want more than one tangent you will need a  motion path node for each one.

As I say not got a use for this but when I do I will have forgotten how I did it so thought I would throw it up here.
Final setup.







Size matters


Quick little tip to get your maya scenes to be the right size. This is particularly important if you are working between multiple software packages (such as mudbox / motion builder etc) or if you are doing dynamics.

Did you realise that the standard grid in Maya is only 12cm x 12cm. Most people seem to model with this grid and then find that when they transfer to for example mudbox that the model is tiny.

In Maya goto Display - Grid and bring up the properties.
Length and width sets how many units you will cover in the 3D viewport grid. (in your main settings you set the unit, default is cm). Increase this to 150 (i.e. 1.5m)
Set Grid lines to 50 (gives you a main division of 50cm)
Subdivisions of 5 (this divides every grid line into 10cm squares)
I also like to have the numbers on the grid.

Now when you model is it easy to work without the grid becoming tiny, so your average humanoid would be about 18 gridlines high (180cm)