I’m trying to have a child with a physics constraint allowing for movement only in child’s z axis. Is this possible? When I rotate parent, child will not follow, because all other axis’s except z are locked on child. This doesn’t seem like desirable behavior. You would imagine child would follow parent and only 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 components setup. In this setup I’ve adjusted Physics contraint “ZSlide” to link component A (Itself - “ZSlide”) with Component B (MainPivot) , This was only way I could get constraint to behave somewhat as expected. In this setup all settings are locked except 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 pendulum he sits on “Main PIvot”), if his character capsule hits an angle, then his capsule and thereby anything underneath is rotated by impact force - even though I have rotation and other two axis of linear movement locked. So my work around is to update capsule rotation and location back to 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 way I would expect it to work. By linking contraint from character capsule to main pivot (or most combinations inbetween) and locking angular movement and two linear movement axis’s (leaving only “z” linear movement axis on limited to 1000) character is locked Globally. This means that if I rotate “Main Pivot” Scene node that sits at top of my hierarchy child “Character capsule” stays put. EVen though I can see from tracing that Main pivot node is in fact rotating and should be moving my character capsule. So it appears that using those settings locks character capsule from having a parent influence it.
Would you mind linking me to your BP’s .uasset? I’ve attempted to duplicate issue you’re describing but haven’t been able to so far, and getting a look at all your setup might help me find source of problem.
I also want to make sure I understand what you’re trying to do. You mention that when you link constraint between character capsule and root component, it locks 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 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. idea is this is like a pendulum and 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 character capsule - it is moved back towards world origin ( lets just say it sit’s halfway between main pivot (0,0,0) and 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 swinging of main pendulum arm. So moving forward is actually just rotating “Main Pivot” in direction of forward. reason being is that my world is spherical but inverted - so you walk around on inside of a sphere. 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 pendulums direction - because gravity is a child of character capsule so it’s always above it pushing downward. This allows me to have a simulated gravity. problem I’m trying to solve (with constraints) is that when physics are enabled on my capsule - if character is moved (rotating main pivot) and collides with a slope/ angled floor it causes character capsule to rotate direction you would expect from colliding. Which usually is character capsule falling forward and then rolling around on floor. So with constraint hooked up, I’m trying to limit character capsule to only sliding up and down locally (which is along pendulum’s arm). This allows 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 constraint to “lock” all linear movement axis’s (except desired up/ down axis) and I lock all angular axis’s, then my character will not follow pendulum (main pivot) when it is rotated - it will only allow him to slide down to ground along axis that I have free, but he should be following his parent’s rotation, and only have his local axis’s locked. By tracing between Main Pivot and KillRaidus Scene node’s I can see that rotation is in fact happening, only my character capsule stays put (ignores parent’s rotation).
In image attached you can see effect. In shot 1 you have exact setup that cause character not to move ( to be constrained globally). In shot 2 character has just fallen to floor from force being applied downward. In shot 3 you can see same trace that was directly above his head has moved forward and slightly to left. This trace is going from KillRadius Node location to Main Pivot Node location (0,0,0). reason it’s forward and to left is because I’ve moved forward, which rotates main pivot, kill Radius is a child of that so it’s rotated forward and to left. However character capsule has not - because constriant depicted in one and four has locked those axis’s. If it’s only constrained locally then character would move, because main pivot has been rotated, but character is locked in position and cannot update to it’s relative rotation.