業界トップクラスの求人数を誇る転職エージェントPR

リクルートグループのコネクションを活かした非公開求人も充実、他にはない好条件の求人と出会える

0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

モーショントレイルを使って遊ぶ

Posted at

モーショントレイルは見てておもしろいですね。

キーフレームの情報がダイレクトに反映されるので、何かに使えそう・・・・

表示されてるし、選択できるし、きっと何かshapeを持っててるんだろうな。

という安易な発想からスタートしました。

観察

image.png

なるほど解らん。

それっぽいのは points

import maya.cmds as cmds
cmds.getAttr("motionTrail1.points")

でなんかいっぱい帰ってきた!

で、これらの位置は何だろうかというのを確認してみる

import maya.cmds as cmds
points = cmds.getAttr("motionTrail1.points")

for point in points:
    node = cmds.createNode("joint")
    cmds.xform(node,ws =True,t = point[:-1])

image.png

ゾワワ
なるほど、カーブの位置情報ですね。

加工

じゃぁこれを加工してあげればいいんですが・・・
このアトリビュート array型なのでここから加工するのがメンドイ

なので、exprespyを活用してみようかと
https://github.com/ryusas/maya_exprespy

pointsをもらってきて

points = motionTrail1.points

これをカーブデータに変換して、既存のnurbsCurveに差し込む

points = motionTrail1.points

pointArrayFn = api.MFnPointArrayData(points)
curveData = api.MFnNurbsCurveData().create()
api.MFnNurbsCurve().createWithEditPoints(pointArrayFn,3, api.MFnNurbsCurve.kOpen, False, True, True, curveData)
curveShape1.create = curveData

さてどうでしょうかね

image.png

image.png

うん 出てますね。

キーフレームを変えても
image.png

ついてきてくれますね。
こうなればただのnurbsCurveなので色々できそうですな!

まとめ

  • exprespy便利ですね
  • motionTrail 過ぎたフレームの色かわるので、現在位置取れる。
  • 実際アニメーションさせるとどうなるかはちょっと心配
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up

Qiita Conference 2025 will be held!: 4/23(wed) - 4/25(Fri)

Qiita Conference is the largest tech conference in Qiita!

Keynote Speaker

ymrl、Masanobu Naruse, Takeshi Kano, Junichi Ito, uhyo, Hiroshi Tokumaru, MinoDriven, Minorun, Hiroyuki Sakuraba, tenntenn, drken, konifar

View event details
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?