#How to freeze position and rotation in Unity Physics?

1 messages · Page 1 of 1 (latest)

real kite
#

i want to constraint all rotation and z-axis. but it doesnt work.

#

how it makes work?

lone siren
#

i don't know why they've never hooked the baker up to this to work

#

i think you need to set the InertiaTensor

real kite
#

this one?

lone siren
#

i believe you can only set it via the custom authoring or at runtime

#

oh wait i just saw you highlighted that

#

i didn't realize that was there

#

yeah that might work

real kite
lone siren
#

i don't know, i haven't used rigidbody authoring in a long time

#

i only use the custom authoring scripts

real kite
#

oh..

real kite
lone siren
#

setting these to infinity will lock rotation around the axis

real kite
#

my player entity just through platform

#

and fall down

#

why this happen

lone siren
#

as i said, idon't know if this was ever hooked up to the normal rigidbody - it wasn't for a long time but it probably is now

real kite
#

holy moly

lone siren
#

however for the record though, i'm not sure there's a way to freeze movement without a custom script in the simulation (probably not that hard)

#

it might only be possible to freeze rotation

real kite
#

am i just create some force freeze system?

lone siren
#

i've never looked too much into it because i haven't had a need, but there are all these injection point systems within unity physics simulation that let you manipulate the simulation

#

so i'm sure you could stop z movement if you want in there

#

i can't help you with the correct timing though

#

unity physics really wasn't designed for 2d sadly which seems to be what you want here

#

but there are people who make 2d games so maybe they have a better idea

real kite
#

got it

#

thank you!

brazen badger
# real kite am i just create some force freeze system?

https://github.com/Unity-Technologies/EntityComponentSystemSamples/blob/master/PhysicsSamples/Assets/8. Joints and Motors/Joints - Limit DOF.unity
this is a current way to constrain some axis
if you have small amount of entities it will be fine, I hope you aren't going to constrain millions of tiles of 2d grid-map

GitHub

Contribute to Unity-Technologies/EntityComponentSystemSamples development by creating an account on GitHub.

real kite
#

what am i looking this file

#

i need any keyword

#

this one?

lone siren
#

maybe just look at the sample

brazen badger
real kite
#

ok thank you

real kite
#

@brazen badger this one?

brazen badger
#

basically it's a joint but joint to nothing
you can even unparent it (because parenting is shitty thing to have) or create during runtime if you know what to do