|Bilbo Beutlin (BBeutlin)||16.03.2015 10:53|
|I want to attach an arbitrary object to a crane hook which is moveable up-down.
So far I use the method:
local constr = JointConstructor:new();
... etc. ...
attachedobject.JointIndex = constr:finalize();
So far it works. However the object is fixed, doesn't move with the crane hook. And "setActors()" only works with rootNode, otherwise crashes.
How can I make it moveable with the hook?
|Emil Drefers (Unknown)||16.03.2015 14:36|
you have to update the joint.
setJointFrame(jointindex, anchorActor, joinitNode);
as used in
|Bilbo Beutlin (BBeutlin)||16.03.2015 15:49|
|Thanks, I got it :)
Besides: is there a way (joint method) without explicitely updating? so that the attached object moves 'automatically' with the attacherNode?
|Emil Drefers (Unknown)||17.03.2015 09:55|
you would need to move not only the "attacherNode" but also the rigid body of which the attacherNode is a child.
As soon as the position of the attacherNode relativ to its "rigid body parent" changes you have to update the joint.
|Bilbo Beutlin (BBeutlin)||18.03.2015 01:46|
|I have still problems with my hook attacher.
Now the object follows the crane hook on movement. But when the hook stops, the object jumps back to initial position. What's missing?
Piece of code:
for i,att in pairs(self.attachedObjects) do
posX,posY,posZ = getTranslation(att.object);
setTranslation(att.object, posX + deltaX, posY + deltaY, posZ + deltaZ);
setTranslation(att.AT, posX + deltaX, posY + deltaY, posZ + deltaZ);
setJointFrame(att.JointIndex, att.object, att.AT);
Note: Log in to post. Create a new account here.