So. I’m down to trying to get the physics down for my game, and I’ve got one problem.
See, what I’m trying to do is relatively simple. An emulation of a spring, that normally I would apply by checking between the local difference between where a part is and where it’s supposed to be in relation to the body and adding force to both objects to return them to that position. The setup of the test object I used is simple - a cube, to which I attach a physics constraint which I move into the final position of the attached object, and to that physics constraint I attach a sphere. Set them to lock onto one another, and give the
I assumed I could obtain the local orientation with “Get Relative Transform”, breaking it into components and looking at it’s coords. But instead of the coords I expected (I expected either 0, 0, 0 as it was the XYZ offset, in the viewport, of the sphere in relation to the physics constraint, or -50, -75, -50 which was the coordinates of the sphere compared to the cube’s center) I got the coordinates from a completely different point, which I assume is the world root.
Is that not the purpose of “Get Relative Transform”? How is an object that has another object attached to it not it’s parent? Am I really going to need to code a whole trigonometric local-coords-equivalence for that?
I’m confused. It doesn’t help if I set the cube as the root component either. Little bit of help?
Am I allowed to bump this up?
Can you show your blueprints?
It’s a basic thing that I whipped up specifically for the test, but it’s what I would have expected to work according to the tootip. J nudges the cube so that it changes position, K makes the sphere move back.
For reference, here’s also my component structure:
Maybe I do not get it really but here it goes.
When you pres J everything moves. And when you press K you set to relative location from the sphere(x50. y75. z50).
The PhysicsConstraint is not linked to anything at the moment right?
The problem you facing is when you press K he is not setting the Sphere with a little offset but in total random place in the world? does the place from Sphere change when you press mulitple times K?
The PhysicsConstraint is linked to the cube, and references the sphere and the cube as the components of the constraint.
THOUGH I need to run some tests, because you’ve enlightened me to a possible scenario. I thought the “sets the motion relative to the parent” meant that if the sphere was the child component of the cube it would move in relation to the cube, but I find it possible that the relationship was that the node was a child element of the sphere. Will report back soon.
EDIT: Made some tests, I was wrong. It always sets, or at least tries to, set the sphere’s position in a global scale - so since it’s joined to the cube, it will slowly pull the cube towards that coordinate.
I’d really like an answer :c
I not sure what you want. But if you want get the offset you only neee get the sphere transform.