Notifications
Clear all

[Closed] Ground detection as in motionbuilder?

Would anyone of masters of Maxscript be kind enough to share some secrets of how to create an IK leg rig (bipedal), with “ground detection” feature? Tutorial maybe? I know that it has something to do with “rays”… but how? Internet is dry about this topic.

8 Replies
 JHN

Motionbuilder ground detection has nothing to do with rays, it’s the ground plane helper that determines the height of the ground. So it’s a simple “if myZpos < helperZpos then myZpos = 0”

You can accomplish the same with the limit controller on the IK helper, or any object that drives the foot position and lives in world space.

Hope that helps,
-Johan

OK, let me redefine the question, motionbuilder was just an example, I want to know how to create a leg rig whose foot controller shoots rays in all directions and detects all the other geometry in the scene, measures distance from it, and if distance is xxx (i.e. 0), prevents penetration of foot controller into “touched” geometry… such objects or sensors whatever you want to call it could be placed at other places on the rig as well… to stop penetrations of let’s say elbows, palms, knees…etc.

 j83

For a reference I would try looking at the “How To … Move Objects to a Surface” in the Maxscript reference,

[left][color=blue]macroscript[/color] MoveToSurface category:[color=maroon]“HowTo”[/color]
[/left]
[left](
[/left]
[left][color=blue]fn[/color] g_filter o = superclassof o == Geometryclass
[/left]
[left][color=blue]fn[/color] find_intersection z_node node_to_z =
[/left]
[left](
[/left]
[left][color=blue] [/color][color=blue]local[/color] testRay = ray node_to_z.pos [0,0,-1]
[/left]
[left][color=blue] [/color][color=blue]local[/color] nodeMaxZ = z_node.max.z
[/left]
[left] testRay.pos.z = nodeMaxZ + 0.0001 * abs nodeMaxZ
[/left]
[left] intersectRay z_node testRay
[/left]
[left])
[/left]
[left][color=blue]on[/color] isEnabled [color=blue]return[/color] selection.count > 0
[/left]
[left][color=blue]on[/color] Execute [color=blue]do[/color]
[/left]
[left](
[/left]
[left] target_mesh = pickObject message:[color=maroon]“Pick Target Surface:” [/color]filter:g_filter
[/left]
[left][color=blue] [/color][color=blue]if[/color] isValidNode target_mesh [color=blue]then[/color]
[/left]
[left] (
[/left]
[left][color=blue] [/color][color=blue]undo[/color] [color=maroon]“MoveToSurface”[/color] [color=blue]on[/color]
[/left]
[left] (
[/left]
[left][color=blue] [/color][color=blue]for[/color] i [color=blue]in[/color] selection [color=blue]do[/color]
[/left]
[left] (
[/left]
[left] int_point = find_intersection target_mesh i
[/left]
[left][color=blue] [/color][color=blue]if[/color] int_point != undefined [color=blue]then[/color] i.pos = int_point.pos
[/left]
[left] )[color=green]–end i loop[/color]
[/left]
[left] )[color=green]–end undo[/color]
[/left]
[left] )[color=green]–end if[/color]
[/left]
[left])[color=green]–end execute[/color]
[/left]
[left])[color=green]–end script[/color]
[/left]
[left]

[/left]

Nice… but how to apply this in real world?

Check out the attachment for examples of using intersect ray in script controllers. Also if you have time here is a demo video of a max script I wrote which uses intersect ray quite alot:
http://www.vimeo.com/7517758

Cheers

Dan

Well, now I know that you are good at programming in MXS, and that’s all… I’m not an employer and I don’t need a script for automatic creation of the rig based on the model’s geometry etc etc…
am I being unclear or what?

Maybe I was unclear, the attachments I added to my previous post are a couple max scenes of real world setups for ground detection. Is that not what you wanted?? The video was just an extra to show what you can do with intersect ray. Did you download and open Zip file with the scene files?

Kind of wished I hadnt botherd now!

Oh well hope you find what your looking for

Cheers

Dan

Nice rig tool Dan!