fix(snap): wrong backing field for C1
This commit is contained in:
parent
722c4acfb4
commit
f6d778e3ed
1 changed files with 3 additions and 2 deletions
|
@ -5,7 +5,6 @@
|
||||||
#include "objects/datamodel.h"
|
#include "objects/datamodel.h"
|
||||||
#include "objects/jointsservice.h"
|
#include "objects/jointsservice.h"
|
||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
#include "part.h"
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <reactphysics3d/constraint/FixedJoint.h>
|
#include <reactphysics3d/constraint/FixedJoint.h>
|
||||||
#include <reactphysics3d/engine/PhysicsWorld.h>
|
#include <reactphysics3d/engine/PhysicsWorld.h>
|
||||||
|
@ -40,7 +39,7 @@ Snap::Snap(): Instance(&TYPE) {
|
||||||
.codec = fieldCodecOf<Data::CFrame>(),
|
.codec = fieldCodecOf<Data::CFrame>(),
|
||||||
.updateCallback = memberFunctionOf(&Snap::onUpdated, this),
|
.updateCallback = memberFunctionOf(&Snap::onUpdated, this),
|
||||||
}}, { "C1", {
|
}}, { "C1", {
|
||||||
.backingField = &c0,
|
.backingField = &c1,
|
||||||
.type = &Data::CFrame::TYPE,
|
.type = &Data::CFrame::TYPE,
|
||||||
.codec = fieldCodecOf<Data::CFrame>(),
|
.codec = fieldCodecOf<Data::CFrame>(),
|
||||||
.updateCallback = memberFunctionOf(&Snap::onUpdated, this),
|
.updateCallback = memberFunctionOf(&Snap::onUpdated, this),
|
||||||
|
@ -82,6 +81,8 @@ void Snap::buildJoint() {
|
||||||
part1.lock()->cframe = newFrame;
|
part1.lock()->cframe = newFrame;
|
||||||
workspace->SyncPartPhysics(part1.lock());
|
workspace->SyncPartPhysics(part1.lock());
|
||||||
|
|
||||||
|
// printf("c1.Rotation: ");
|
||||||
|
// printVec(c1.ToEulerAnglesXYZ());
|
||||||
rp::FixedJointInfo jointInfo(part0.lock()->rigidBody, part1.lock()->rigidBody, (c0.Inverse() * c1).Position());
|
rp::FixedJointInfo jointInfo(part0.lock()->rigidBody, part1.lock()->rigidBody, (c0.Inverse() * c1).Position());
|
||||||
this->joint = dynamic_cast<rp::FixedJoint*>(workspace->physicsWorld->createJoint(jointInfo));
|
this->joint = dynamic_cast<rp::FixedJoint*>(workspace->physicsWorld->createJoint(jointInfo));
|
||||||
jointWorkspace = workspace;
|
jointWorkspace = workspace;
|
||||||
|
|
Loading…
Add table
Reference in a new issue