Hello Unreal Forums!
I was thinking on how someone would work around some sort of movement like in Bloxorz, by rotating the cube by it’s horizontal and vertical axis. Would anyone be able to guide me towards a solution or show me a blueprint, Thanks! Any help is appreciated.
You need either play with 3d modelling application, and make animations for all flips (2 animations)
Or solve some trigonometry and find formula for location and rotation of cube when you rotate it around one of edges.
When you have either of those 2. You just play animation of move. Then you update location of cube to new location.
There is also one more possibility. If you create cube model and place pivot exactly in one of its corners, you cann just do interpto and set rotation, or add rotation over time in event tick.
Then when you want to make next move, you set new rotation and location so that corner in pivot is in new place around which cube rotates. So this is some thinking how to fake and flip box or you solve trigonometry (very basic).
And last idea, that is probably best way. You make that box with pivot exactly in center. Then you pick point (edge) you want to rotate it around. Now make vector from edge to center.
If you rotate that vector around axis of edge, you will get location of cube. and you can just add rotation of animation to current rotation of cube. So no trigonometry here.
This is cool problem, i may play with it some day, but no promises.
So i found this video :
But thing is, i want my cube to be 1x2 dimensions. But somehow it doesn’t work when i scale the cube up to 1x2.
This is what happens.
Well I took a peek at that project and it seems like it goes for the mathematical approach. So all you have to do is tweak the numbers a bit. Time to learn a bit about vector math and all that good stuff!
I have no clue where to start tweaking in the level blueprint, could you help me out?
Well it looks like the animation itself is happening in the “MoveTween” function so you might want to look into that and try to make sense out of it. This goes above my head so I can’t really help, but I’d start there.
Don’t scale it to 1x2. Instead, do it from your modelling application. My approach would be a lerp with rotate around axis or root motion.
What do you mean by “Modelling application” ? I haven’t made the cube nor the logic for the cube. i found this project i want to find out how to make it 1x2. Could you try to send some pics of how you would lerp with rotate around axis or root motion?