Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
sinisas3237yBest 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. -
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.
-
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. -
Mitiko63557yWell 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 -
@Totchinuko oh yeah maybe i use physic material and set its friction so it always slips
-
@Olverine how can u just say its locked in x-axis just by looking are u god. but yeah its locked
-
@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!
Related Rants
-
sam966931Difference between C# and Javascript Me: Hold my cup of tea. C#: That's not a cup of tea. Me: Hold my cup o...
-
rizasif9230Apple rejected my app, because they throught there was a frickin Windows phone on my loading screen. How inse...
-
ZioCain28How do you even come up with shit like this?
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
undefined
unity3d
c#
unity