ScriptSpot

Forum topic · General Scripting

Help With a Placing and Rotating Tool

By DanTronMcTronDan · 2014-06-26

Description

I know very little of coding, and I'm trying to hack my way through a script that merges a file (this part has been easy), selects a bone in the file (also easy), and lets me click in the viewport and place it (again, pretty easy).

What I need next is something that doesn't seem trivial; I'd like a piece of code that rotates the selected object to point toward the mouse until I click. I just want to be able to quickly drop in this object and rotate it graphically.

print "Click to Place the starting point of the Jetway"
mergeMaxFile ("otherJetway.max") #autoRenameDups #useMergedMtlDups
select $B1C1
pnt = point3 0 0 0
pnt = pickPoint snap: #2D rubberband: pnt
$.pos = pnt 
$.name = "PLACEDROOTBONE"

I'm sure my coding is ugly, but is there a way to have some kind of live function that keeps spinning the current selection to face the mouse until I click somewhere in the viewport?

Comments (3)

aand now the script doesn't work at all

DanTronMcTronDan · 2014-06-26

I have no idea what I'm doing.

DanTronMcTronDan · 2014-06-26

That looks cool, but not really what I'm after. I've got a pretty specific application in mind, which involves placing jetways and targeting specific bones in a skinned mesh. This is why I'm asking for help with the code, and not an existing script.