PDA

View Full Version : Rotate and Align Biped (help?)


taniamc
08-20-2007, 11:49 PM
Hi there,

I've got this script that creates a dummy and aligns it to a biped to mark its position. Then it mirrors the biped.
I'm having trouble with the next two steps. I need to moveAll rotate the biped 180 degrees.
I tried using this as a work around, as I can't figure out how to acces the moveAll tool in maxscript.

bipObj = getNodeByName rootName[i]
bip = bipObj.controller
biped.mirror bip
d = dummy()
bipObj.parent = d
rotate d (eulerangles 0 0 180)
delete d
bip.moveAllMode = true
bipObj.transform = dummyArray[i].transform


Unfortunately, when I try to rotate like this... the character does not rotate in place, but displaces when it rotates. I can't seem to figure out why. I also can't seem to access the align tool like I'd like, so I tried just copying over the transforms, which results in the character in the right place, but upside down.

bipObj.transform = dummyArray[i].transform

Mayday? :argh:

chewbacca007
08-21-2007, 06:15 PM
I'm not sure exactly what you are going for but this will rotate a biped 180.
At the very least maybe it will give you some ideas.


--Created 08-21-07
--Rotate Biped 180 Degrees
(
if classOf $ == Biped_Object then
(
jawa = $
select (biped.getNode jawa 13 link:1)
jawa = $
utiniBiped = jawa.controller
utiniBiped.trackselection = 3
biped.createLayer utiniBiped 1 "Rotate Layer"
rot_obj = eulerangles 0 0 180
rotate $ rot_obj
biped.setSelectedKey utiniBiped
biped.collapseAtLayer utiniBiped 0
clearSelection()
)
else messageBox "You're a Wizard Harry!\nUse your magic to select a Biped first!\n"
)
)

-Chris

taniamc
08-21-2007, 07:42 PM
Chris,

Very clever, why didn't I think of that?
Unfortunately, its still not working for me. If I mirror first and then rotate, the arms flip out during the entire animation (which was already on the biped to begin with). If I rotate first and then mirror, it seems like the animation is actually going backwards, lol.

I don't necessarily need to set a key on the rotate, I just need to alter his position in a similar fashion to the moveAll tool. However that can be done...

It looks like alot of what is causing these issues is the mirroring...

chewbacca007
08-21-2007, 07:58 PM
Tania,

Glad I was of some help. I haven't done a lot of scripting. But I give it a go when I have the time.

What exaclty are you trying to align? A Biped to something?

-Chris

taniamc
08-21-2007, 08:04 PM
Chris, I thought it was working and then everything started going backwards.

I'm trying to align the biped to a marker preserving the bipeds position before I mirror it...

Trying one more thing for the rotate, hopefully it works.

taniamc
08-21-2007, 10:34 PM
I was able to get the rotate mirror thing to work.


I used the original code to avoid using layers, which are causing some funkiness when paired up with mirroring these fun files.

Only now I rotated first, and then mirrored the animation. This seemed to avoid the weird arms stuff that results from mirroring the play and then trying to rotate.


bipObj = getNodeByName rootName[i]
bip = bipObj.controller
d = dummy()
bipObj.parent = d
rotate d (eulerangles 0 0 180)
delete d
biped.mirror bip


I was still dealing with the align mystery, when it occured to me...
Maybe with the rotation mirror craziness solved, the align might work

So I re-released that line of script

bipObj.transform = dummyArray[i].transform


And it worked. Two things that I did notice... when the script finishes the characters arms look weird, but if you move about the timeline, the weirdness disappears. Also, It seems to shift everyone over to the left slightly, but it shifts them as a group so the contacts are still good. Slight camera adjust and we are good to go :)

taniamc
08-22-2007, 03:54 PM
If anyone can clue me into why the characters are getting shifted, I would love to know why.

I'm guessing it has something to do with the fact that when I rotate them like I'm doing, they don't rotate in place but actually move positions... maybe?
I don't know how to avoid it though.

CGTalk Moderation
08-22-2007, 03:54 PM
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.