Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® MotionBuilder® / Python / Keying a constrained object (plot one frame)
  RSS 2.0 ATOM  

Keying a constrained object (plot one frame)
Rate this thread
 
34301
 
Permlink of this thread  
avatar
  • cwikdahl
  • Posted: 10 September 2009 09:11 PM
  • Location: Sweden
  • Total Posts: 18
  • Joined: 03 February 2007 04:16 AM

Hi,

I’m going a bit nuts. After trying many different solutions I have ended up using a constraint to transfer rotation from one object to another. This should only be temporary so I want to key the constrained object to it’s new value, and then delete the constraint. Problem is keying is done with the old value, disregarding the constraint and the current rotation of the object.

This is the snippet that doesn’t work, from activiatingthe constraint:

cnst.SetActive(True)

FBSystem()
.Scene.Evaluate()

lAnimNodes 
mGRBD.AnimationNode.Nodes  
for lNode in lAnimNodes:
 if 
(lNode.Name == 'Lcl Rotation'):
 
lNode.KeyCandidate()
 
cnst
.FBDelete()

The constraint works, but not the keying. Any ideas?

Clarification: It sets a key, but with the value it would have been without the constraint.

/Claes



Replies: 0
avatar
  • KxL
  • Posted: 12 September 2009 07:33 PM

A little around the topic - but why you need to use constraint to transfer rotation? Can you explain it, so maybe I will be able to help you?

As for keying. I think solution that could work (untested) is getting rotation vector for a model after you activate constraint and evaluate scene. And then you can add this value to FBAnimationNode by KeyAdd(...).

Cheers



Replies: 0
avatar
  • cwikdahl
  • Posted: 14 September 2009 07:58 PM

When getting the values directly sometimes it flipped. Probably becuase there are close-to-180 on X and Z. Only want to rotate around Y.

I was 100% sure I tried what you suggested, to get the values on the object itself after it was constrained, but I couldn’t have, becuse it works! Thanks :)

/Claes



Replies: 0