Unfortunaly, Rama’s WIKI article is the only “documentation” about constraint components in C++.
I copied the code from his wiki-page that should set up a new constraint-component connection between two actors.
So, I implemented it and set all the Linear and Angular Motions to locked. But it does nothing. I spawn the first object on a cliff and try to connect the second object, but instead of connecting to the first object it just falls to the ground.
All the functions are called with the right actors and I didn’t change anything in the code-example except the function-values for setting the motion-values.
The Actors have SetSimulatePhysics = true.
here is my code:
FConstraintInstance constraintInstance;
FConstraintConnectionGenerator gen;
constraintInstance = gen.getInstanceFor(base.parentElement->getElementType(), target.parentElement->getElementType()); // Gets the "right" values for specific types of objects
StaticUtilityLibrary::CreateNewPhysicsConstraintBetween(base.parentElement, target.parentElement, constraintInstance); //Ramas functionality in a static class
}
FConstraintInstance FConstraintConnectionGenerator::getInstanceFor(EBotElementType base, EBotElementType target){
FConstraintInstance inst;
if (base == BET_ROD){
/************************************ THIS IS CALLED IN MY TEST ***************************** /
StaticUtilityLibrary::SetLinearLimits(inst, false, 2, 2, 2, 2);
StaticUtilityLibrary::SetAngularLimits( //or make functions below non static, put in .h
inst,
2, //locked
2, //swing 2 locked
2, //twist is locked
0, //swing 1 angle limit
0, //swing 2 angle limit
0 //twist locked
);
}
return inst;
}
Am I missing something, or did something change or what am I doing wrong?
Thanks for your help.