I’m trying to have a child with a physics constraint allowing for movement only in the child’s z axis. Is this possible? When I rotate the parent, the child will not follow, because all the other axis’s except z are locked on the child. This doesn’t seem like desirable behavior. You would imagine the child would follow the parent and only the child local axis’s would be locked.
Constraints are relative between two components or actors. Could you post your constraint setup as I’d expect this behavior to work.
Here you can see the components setup. In this setup I’ve adjusted the Physics contraint “ZSlide” to link component A (Itself - “ZSlide”) with Component B (MainPivot) , This was the only way I could get the constraint to behave somewhat as expected. In this setup all settings are locked except the Linear Movement in Z axis - this one is limited to an amount. What happens though is that in this setup if I were to move my character (by rotating the pendulum he sits on “Main PIvot”), if his character capsule hits an angle, then his capsule and thereby anything underneath is rotated by the impact force - even though I have rotation and the other two axis of linear movement locked. So my work around is to update the capsule rotation and location back to the appropriate zero’d out stats so that each tick he looks like he’s not moved by being bumped around through physics, this allows his “z” axis to only be effected and nothing else. While this works , it doesn’t really constrain in the way I would expect it to work. By linking the contraint from the character capsule to the main pivot (or most combinations inbetween) and locking the angular movement and the two linear movement axis’s (leaving only the “z” linear movement axis on limited to 1000) The character is locked Globally. This means that if I rotate the “Main Pivot” Scene node that sits at the top of my hierarchy the child “Character capsule” stays put. EVen though I can see from tracing that the Main pivot node is in fact rotating and should be moving my character capsule. So it appears that using those settings locks the character capsule from having a parent influence it.
Would you mind linking me to your BP’s .uasset? I’ve attempted to duplicate the issue you’re describing but haven’t been able to so far, and getting a look at all your setup might help me find the source of the problem.
I also want to make sure I understand what you’re trying to do. You mention that when you link the constraint between the character capsule and the root component, it locks the capsule’s movement. Is that not what you expected? What are you trying to accomplish exactly with your character?
I don’t mind at all - How would I go about that? Essentially my Root node sits at 0,0,0. and is a “Scene” Node (so it’s just a transform I believe). Then the Kill Radius is a child of that and is also a Scene node - it sits far away from it’s parent, currently it’s about 100,000 units away in one axis only. The idea is this is like a pendulum and the distance it sits at is my maximum distance from 0,0,0 that anything in my world can be. As a child to that node is the character capsule - it is moved back towards the world origin ( lets just say it sit’s halfway between the main pivot (0,0,0) and the kill Radius (100,000, 0, 0). This node( character capsule) has physics enabled but gravity disabled. For my game I’m trying to keep all character movement limited to the swinging of the main pendulum arm. So moving forward is actually just rotating the “Main Pivot” in the direction of forward. The reason being is that my world is spherical but inverted - so you walk around on the inside of a sphere. The reason that I’m trying to use contraints is so that I can fake gravity by using a force (called Gravity in my setup). This force always pushes down relative to the pendulums direction - because the gravity is a child of the character capsule so it’s always above it pushing downward. This allows me to have a simulated gravity. The problem I’m trying to solve (with constraints) is that when physics are enabled on my capsule - if the character is moved (rotating the main pivot) and collides with a slope/ angled floor it causes the character capsule to rotate the direction you would expect from colliding. Which usually is the character capsule falling forward and then rolling around on the floor. So with the constraint hooked up, I’m trying to limit the character capsule to only sliding up and down locally (which is along the pendulum’s arm). This allows the character to slide upwards if it move towards a slope/ hill or fall downward if he walks off a cliff.
What I run into though is that if I use the constraint to “lock” all the linear movement axis’s (except the desired up/ down axis) and I lock all the angular axis’s, then my character will not follow the pendulum (main pivot) when it is rotated - it will only allow him to slide down to the ground along the axis that I have free, but he should be following his parent’s rotation, and only have his local axis’s locked. By tracing the between the Main Pivot and the KillRaidus Scene node’s I can see that the rotation is in fact happening, only my character capsule stays put (ignores the parent’s rotation).
In the image attached you can see the effect. In shot 1 you have the exact setup that cause the character not to move ( to be constrained globally). In shot 2 the character has just fallen to the floor from the force being applied downward. In shot 3 you can see the same trace that was directly above his head has moved forward and slightly to the left. This trace is going from the KillRadius Node location to the Main Pivot Node location (0,0,0). The reason it’s forward and to the left is because I’ve moved forward, which rotates the main pivot, the kill Radius is a child of that so it’s rotated forward and to the left. However the character capsule has not - because the constriant depicted in one and four has locked those axis’s. If it’s only constrained locally then the character would move, because the main pivot has been rotated, but the character is locked in position and cannot update to it’s relative rotation.