View Full Version : [SDK] About nodes, again..
eledh_telamion 02-16-2007, 11:12 AM SDK question.
How I get a node position at time t-1, t and t+1. I need this to get the velocity vector. In two cases, I nedd t and t+1 pos values, because this is the initial frame of the aimation of the node and t-1 and t when it's the end. How I know when it is the start and the end of the animation of this node?
How to add a rotation value with a quaternion to a node. I'va tried it with SetObjOffsetRot() but doesn't work well: changes the pivot points to object center, and moves all the nodes to the same position. What I need is to rotate using the pivot point, as if I was wroking manually in MAX.
Thanks!
|
|
hblan
02-18-2007, 10:37 AM
SDK question.
How I get a node position at time t-1, t and t+1. I need this to get the velocity vector. In two cases, I nedd t and t+1 pos values, because this is the initial frame of the aimation of the node and t-1 and t when it's the end. How I know when it is the start and the end of the animation of this node?
How to add a rotation value with a quaternion to a node. I'va tried it with SetObjOffsetRot() but doesn't work well: changes the pivot points to object center, and moves all the nodes to the same position. What I need is to rotate using the pivot point, as if I was wroking manually in MAX.
Thanks!
1.
posArray = for i = timeStart to timeEnd collect (at time i;theNode.pos)
-- if u want get the 3 positions at time t . then it should be : posArray[t-1] posArray[t] posArrray[t+1] .
-- for a object , when a property animated . it has a controller , u can get the controller`s keys array to get the first or the last animate frame of the Node . for the animation of the Node start is , for example : theNode.pos.keys[1].time . the end of the Node aniamtion is :
theNode.pos.keys[theNode.pos.keys.count].time
2.
theRotQuat = quat 30 [1,0,0] -- angle = 30 . axis:[1,0,0] . this is in world coordsys .
theRotMatrix = therotQuat as matrix3 -- convert the quat to matrix3 value .
-- for the node :
theNode.transform = theRotMatrix *theNode.transform -- this will rotate the node in local axis x .
eledh_telamion
02-19-2007, 11:31 AM
It was a SDK question, not MAXScript. Sorry, but I write it two times, always happens the same...
eledh_telamion
02-26-2007, 11:38 AM
How to add a rotation value with a quaternion to a node. I'va tried it with SetObjOffsetRot() but doesn't work well: changes the pivot points to object center, and moves all the nodes to the same position. What I need is to rotate using the pivot point, as if I was wroking manually in MAX.
I reply miself to this question. Obviously SetObjOffsetRot() isn't the answer but, i found Rotate method that would work well if i've understand well. The SDK help is the next:
virtual void Rotate(TimeValue t, const Matrix3& tmAxis, const AngAxis& val, BOOL localOrigin=FALSE, BOOL affectKids=TRUE, int pivMode=PIV_NONE, BOOL ignoreLocks=FALSE)=0;
This method may be called to rotate the node about the specified axis system. Either the pivot point, or the geometry of the object, or both the pivot and the object may be transformed. Optionally, any children of the node can be counter transformed so they don't rotate. There is also a Quat version of this method.
Only one question about it: How I fill the parameters, there are some of them that aren't very understable and I don't know how to fill them. T is obviosuly the time we are, but what is const Matrix3& tmAxis?? All I need is to affect the kids, and rotate by the pivot point. How I have to fill the localOrigin, affectKids, pivMode and ignoreLocks parameters?
All the tries I made, crashes MAX without alerts...
Anybody has used this method?
eledh_telamion
03-05-2007, 11:08 AM
const Matrix3& tmAxis what is it? Where to find info/help? Looks like it isn't help about it.
eledh_telamion
03-06-2007, 10:30 AM
Well. I found what's a const Matrix3, so I tried firstly with setting this parameter as standard x,y,z axis positioned at (0,0,0) pos, but MAX quits without alerts. Any help? I'm getting mad with this.
If it is helpful, I can upload the full project.
scorpion007
03-06-2007, 11:50 PM
firstly, you should be able to ignore every parameter after const AngAxis& val, since they have default values which should be fine.
Secondly, you should be clear about which method you are using. Is it INode::Rotate()?
Finally, if you check the reference for INode::Rotate(), the description tells you exactly what the parameters are used for. Read it more carefully.
eledh_telamion
03-07-2007, 11:39 AM
Secondly, you should be clear about which method you are using. Is it INode::Rotate()?
Finally, if you check the reference for INode::Rotate(), the description tells you exactly what the parameters are used for. Read it more carefully.
ABout, this method, Scorpion007, it's Inode::Rotate(). I use it in the GetValue of the master controller to change to ratations of the slaves nodes by
for (i=0;i<=numNodes;i++){
nodeTab[i]->Rotate(t, ¿?¿?¿?, quat);
}
the second parameter I don't know how to write. I want rotate by it's pivot point (each node has its pivot in certain position, where it's the rotation center).
scorpion007
03-10-2007, 12:04 AM
tmAxis is "The axis system about which the node is transformed." This basically sets the current transformation that you want to use as a reference for your rotation.
eledh_telamion
03-11-2007, 12:33 PM
If I want rotate by its pivot, how to do this? Sorry but MAX SDK is getting me mad...
CGTalk Moderation
03-11-2007, 12:33 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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.