#Question About Critical Thinking ? (tryna code player movement)

1 messages · Page 1 of 1 (latest)

topaz finch
#

The - in front of acceleration is the crucial detail you seem to be missing.
If you left that minus out, you would indeed accelerate the Rigidbody.
However, due to the -, what is actually happening here, is rb.AddForce(rb.velocity * (acceleration * -1));.
Because of that, you get a force opposing the movement direction of the Rigidbody.

Do note that a very similar effect could be achieved by simply increasing the Rigidbody's drag value (which acts similar to air resistance).

median slate
#

i know the minus makes it opposing, but i wanna know how can i exactly nullify the velocity with that force..
meaning i need to figure out the exact force value that can stop the body

median slate
median slate
#

i think the drag works fine

humble sedge
#

@median slate the code will always make the rigidbody stop, tweaking it will just make it stop faster or slower

#

^drag too

median slate
#

that's what i meant..

#

but i think transform.translate and other things are better for that ig

#

tysm!

humble sedge
median slate
#

inf ?

humble sedge
#

But what you're asking is strange... Yeah you probably should just modify transform

median slate
#

yeah i mean i thought that transform is bad for collision or smthn

#

i'm a fan of rb

median slate
#

i didn't know about it

humble sedge
#

Modify velocity directly then?

median slate
#

yup i forgot about that