8

# any unity 3d pro here ? help me out How can i always land my cube at its one of his 4 face not at its corner

• 3
Best is to use physics engine, box would always naturally land on a flat side and not corner.

Doing it like this will never move realistically.
• 5
Cats and jam on each side will do the trick
• 2
Hum looking closely to the cube, it feels like it use physics, if it's the case, you may want to add a physics Material 2D to your collider and do some test with various friction values. I'm doing mostly 3D, but their is the equivalent, and it can get stuck sometimes, when the amount of friction is too high compared to the mass and velocity.
• 0
.
• 2
It looks like you have a rigidbody with locked movement on the x-axis correct?

If you really want to use the physics engine, the easiest way would be to add a physics material with no friction. I think the reason this happens is because the x movement is locked so the cube can't flip over to it's side and the friction is too strong so it basically just holds it in place.

I think I would recommend not using the physics engine for something like this though.
• 0
Well my solution, will have to be a variable for degrees:
Some pseudo code:
Let d is total degrees for rotation
Foreach click:
if jumping from ground:
Let d = 360
Move cube up and start rotation d
else:
Stop rotation
Assign 'degrees left to rotate' to d
//You can play around with the next line
Move up and start rotation d
//Alternatives:
1:
Move up (360-d)/360 parts up
Start rotation d
Continue moving up
2:
Move up but rotate 360+d

Do something similar for falling
• 0
@Totchinuko oh yeah maybe i use physic material and set its friction so it always slips
• 2
@Olverine how can u just say its locked in x-axis just by looking are u god. but yeah its locked
• 1
@fuckwithcodes if it wasn't locked, the cube would fall down to it's side. No way it just lands on a corner and balances like that by accident!
• 2
I'm also a god but that's besides the point.