fix(physics): forgot to track joints
This commit is contained in:
parent
497cbc51e0
commit
dac8d0f4bd
5 changed files with 3 additions and 4 deletions
|
@ -48,6 +48,9 @@ void JointInstance::Update() {
|
||||||
|
|
||||||
// Finally, build the joint
|
// Finally, build the joint
|
||||||
buildJoint();
|
buildJoint();
|
||||||
|
|
||||||
|
part0.lock()->trackJoint(shared<JointInstance>());
|
||||||
|
part1.lock()->trackJoint(shared<JointInstance>());
|
||||||
}
|
}
|
||||||
|
|
||||||
nullable std::shared_ptr<Workspace> JointInstance::workspaceOfPart(std::shared_ptr<BasePart> part) {
|
nullable std::shared_ptr<Workspace> JointInstance::workspaceOfPart(std::shared_ptr<BasePart> part) {
|
||||||
|
|
|
@ -18,7 +18,6 @@ void Rotate::buildJoint() {
|
||||||
// used to be rather than specifying an anchor rotation, so whatever.
|
// used to be rather than specifying an anchor rotation, so whatever.
|
||||||
CFrame newFrame = part0.lock()->cframe * (c0 * c1.Inverse());
|
CFrame newFrame = part0.lock()->cframe * (c0 * c1.Inverse());
|
||||||
part1.lock()->cframe = newFrame;
|
part1.lock()->cframe = newFrame;
|
||||||
part1.lock()->UpdateProperty("CFrame");
|
|
||||||
|
|
||||||
// Do NOT use Abs() in this scenario. For some reason that breaks it
|
// Do NOT use Abs() in this scenario. For some reason that breaks it
|
||||||
PhysJointHingeInfo jointInfo((part0.lock()->cframe * c0).Position(), -(part0.lock()->cframe * c0).LookVector().Unit());
|
PhysJointHingeInfo jointInfo((part0.lock()->cframe * c0).Position(), -(part0.lock()->cframe * c0).LookVector().Unit());
|
||||||
|
|
|
@ -20,7 +20,6 @@ void RotateV::buildJoint() {
|
||||||
// used to be rather than specifying an anchor rotation, so whatever.
|
// used to be rather than specifying an anchor rotation, so whatever.
|
||||||
CFrame newFrame = part0.lock()->cframe * (c0 * c1.Inverse());
|
CFrame newFrame = part0.lock()->cframe * (c0 * c1.Inverse());
|
||||||
part1.lock()->cframe = newFrame;
|
part1.lock()->cframe = newFrame;
|
||||||
part1.lock()->UpdateProperty("CFrame");
|
|
||||||
// Do NOT use Abs() in this scenario. For some reason that breaks it
|
// Do NOT use Abs() in this scenario. For some reason that breaks it
|
||||||
PhysJointMotorInfo jointInfo((part0.lock()->cframe * c0).Position(), -(part0.lock()->cframe * c0).LookVector().Unit());
|
PhysJointMotorInfo jointInfo((part0.lock()->cframe * c0).Position(), -(part0.lock()->cframe * c0).LookVector().Unit());
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@ void Snap::buildJoint() {
|
||||||
// used to be rather than specifying an anchor rotation, so whatever.
|
// used to be rather than specifying an anchor rotation, so whatever.
|
||||||
CFrame newFrame = part0.lock()->cframe * (c0 * c1.Inverse());
|
CFrame newFrame = part0.lock()->cframe * (c0 * c1.Inverse());
|
||||||
part1.lock()->cframe = newFrame;
|
part1.lock()->cframe = newFrame;
|
||||||
part1.lock()->UpdateProperty("CFrame");
|
|
||||||
|
|
||||||
PhysJointSnapInfo jointInfo((c0.Inverse() * c1).Position());
|
PhysJointSnapInfo jointInfo((c0.Inverse() * c1).Position());
|
||||||
this->joint = workspace->CreateJoint(jointInfo, part0.lock(), part1.lock());
|
this->joint = workspace->CreateJoint(jointInfo, part0.lock(), part1.lock());
|
||||||
|
|
|
@ -22,7 +22,6 @@ void Weld::buildJoint() {
|
||||||
// used to be rather than specifying an anchor rotation, so whatever.
|
// used to be rather than specifying an anchor rotation, so whatever.
|
||||||
CFrame newFrame = part0.lock()->cframe * (c0 * c1.Inverse());
|
CFrame newFrame = part0.lock()->cframe * (c0 * c1.Inverse());
|
||||||
part1.lock()->cframe = newFrame;
|
part1.lock()->cframe = newFrame;
|
||||||
part1.lock()->UpdateProperty("CFrame");
|
|
||||||
|
|
||||||
PhysJointWeldInfo jointInfo((c0.Inverse() * c1).Position());
|
PhysJointWeldInfo jointInfo((c0.Inverse() * c1).Position());
|
||||||
this->joint = workspace->CreateJoint(jointInfo, part0.lock(), part1.lock());
|
this->joint = workspace->CreateJoint(jointInfo, part0.lock(), part1.lock());
|
||||||
|
|
Loading…
Add table
Reference in a new issue