So this problem I’m having is quite hard to explain but the basics is that I want to clamp a world space vector in world space such that rotation would be taken into account when clamping for example: where X would be forward Y would be right and Z would be up of some sort of rotation.
Currently I’m converting said world space vector into a local space vector then clamping and converting back to world space
Here is what my test actors event tick looks like:
This is what it looks like when moved
Pink ball is the vector Location showed earlier
The problem is that due to the clamping / conversion this unwanted upwards and downwards motion is created, but my goal is to keep the pink ball in the same place relative to its parent even when clamped and on a rotation
Did a test and it seems the physx engine also does this which leads me to believe that there isn’t a good way of doing this
But I need some solution because I’m creating a motorcycle simulation game and this is needed.
Yeah, this will be going in a blueprint component / blueprint actor
I’ve tried doing the whole setup in local space but then it will always has the same velocity as the parent, and in my case I’m making custom wheel system and there I need the velocities and everything independent of the parent.
Hence the clamping which would keep the wheel along an axis, but problems arise when you have said axis on an angle. It produces a vector alignment problem I suppose that moves it up and down.
I created this very rough example of why this happens, but I have no clue what would be a solution
Pink ball is the imaginary vector (world space) that needs to be clamped
Blue ball is where it gets clamped to (from world space to local space, clamped and back to world space)
Red ball is where I would need the Pink ball to go (world space).
On the left it works fine it gets clamped to that axis and it stays in the same Z height while the rest is clamped.
But the right side is angled at 45 degrees and this is exactly what happens in engine the vector gets clamped to where the blue ball is but the expected result is where the red ball is
It’s easier to visualize and understand if you tilt your head along with the right side.
Sorry, I’m not getting it. As far as I can tell, my example does exactly what you want and does not suffer from what we see in the earlier diagrams.
Maybe stop describing what you need in vector terms, and just say what actual functionality you want. For instance, is this just going to be the wheel on the end of some forks? Like that…