is there a way to create a state where an object acts like it’s on a spring? Like whenever you pick it up it tries to return to a pre-defined rotation? I’m not lookin for a rotation lock because I still want it to be able to rotate, but whenever a force has stopped being applied I want it to spring back to its default position
kinda like those double doors you see in hospitals that close by themselves.
The context for this is I’m making a game where one of the mechanics is picking up and moving around objects with your mouse, I want them to return to a default rotation when picked up but I don’t want them to be locked to that rotation, like it can still turn on its side if you push it against another object for example. Preferably I’d like to use the location the object is being grabbed as a fulcrum point that it rotates around if that’s at all possible
I do have the location the object is grabbed stored as a variable from the grab blueprint which is stored on the player pawn so I can call that up into the blueprints.
Vector Spring Interp is an actual spring but is poorly documented
the Physics Constraint component has linear and angular motors, and all kind of constraints, even plasticity (I’d start here, since it’s well documented)
the Physics Control is the next big thing, already available as an experimental plugin, fairly complex and, obviously, poorly documented atm
I’ll look into physics constraints since it seems it will be the best option. Thanks for the reply. I’m pretty new so would rather use something well documented.
ok so I looked into physics constraints, tried using one on my model and it does absolutely nothing. It doesn’t limit at all no matter what settings I apply.
that’s not what I meant. What I meant was those swinging doors that you push through then they swing back on you. I tried setting that up by limiting rotation but it didn’t work
except this isn’t for a swinging door specifically I just used that as an example, what I’m trying to do is have an object movement system that’s kinda like portal, like when you pick the item up it flips itself to its default rotation, and if you smack the object against something it reacts physics wise but whenever you move it away from the collision it will spring back to its default rotation state. What I’m working on is a 2.5d game so the object in question is already unable to rotate on the X and Z axes, I just want it to correct its own rotation and spring itself back to default while its picked up on the Y axis. The physics constraint doesn’t seem to be doing that though.
picking up and moving around objects with your mouse
Imho, it actually does sounds like a spot on use case scenario for a Physics Constraint angular motor + Physics Handle (that’s what you’re using for holding stuff, right?). Even a simple spring suggested earlier on might do, but you’d use the float variant and only spring on a single axis since the rest is not important.
Perhaps you should spend a bit more time digging into it? And if you ever hit any limitations of the now venerable constraint system (I mean, entire AAA games were made using it…), do look into the experiment plugin. It allows you to set multiple, completely independent control targets and modulate them on the fly. You tell the physics engine where you want to arrive and it will do the rest without you doing the math. Think smart PIDs that you do not need to script yourself.
maybe I’m just not getting where I’m supposed to put the physics constraint component? am I supposed to put it on the mesh component of the actor being picked up? Because when I did that, no matter what settings I changed it changed nothing about how the object reacted. It would still spin and flop around
You could also consider switching them off as soon as the held object hits something, and activate them again when it no longer collides, but is still held if you want it to snap back to the default rotation.
There is also the physics control component which is currently experimental
If you have a look at this video @ 5m 30s the presenter shows pushing a block and it returning it to its current position and the code to do that is before. I think from your description this is what you are looking for.
It was already suggested above twice. OP seemed disinterested since there’s little documentation available. But yes, I’ve been using it for some months now and it works great. Official vid.