How to add Force correctly | Unity Physics 101 (1/3)

preview_player
Показать описание
Unity Physics can be hard. And it is even harder, if you do not know the basic principles. I will show you the core basics in rigidbodies, to give you a kickstart in this topic. In this tree part tutorial you will definitely understand things like .AddForce, .AddTorque and .CenterOfMass way better than through the unity manuals and offical tutorials.
The result is not only a deep understanding of rigidbody, but also you get a really nice script on the hand, that you can copy and paste into your project to directly becoming better at physics prototyping.
The tutorial is split into three parts. The first part is all about positions and translations. You will learn how gravity and velocity work and play together. The second part will be all about angular velocity, torque and how to transform quaternions to vectors and vice versa. The third part is just a quick look at center of masses.

Playlist of the series:

#ditzelgames #unity #gamedev
Рекомендации по теме
Комментарии
Автор

Thank you SOO much, this is literally the only video on youtube about changing acceleration/max speed independently.

sspyrshlsx
Автор

Thank you very much, the script is just what I was looking for!

marekdrabik
Автор

Those explanations and the helper methods are sooo good! thx

dreamisover
Автор

Absolutely helpful. In space there is zero drag, but having zero drag is not gameplay friendly unfortunately lol. This was perfect for what I need.

pixelbi
Автор

Hey Ditzel, thanks for a great tutorial. I am wanting to apply a force to a FPScontroller (rigidbody) when standing on a platform that will throw the character across the map, like in Halo or Quake, so I assume collision trigger is best. Would you have any advice or script available because I am a newb and struggling combining the concept of the rigidbody force with a collider trigger. many thanks

ag
Автор

Hi there, great tutorial! Is there a way to set a fixed velocity for a rigidbody? Or a way to reset the rigidbody to the initial magnitude(speed). Let's say I have a ball floating around in a space with hardly any gravity. The ball gains a slight velocity when it collides with other objects. Is there a way to set the speed of the ball back to the initial speed? With other words, how can I keep the magnitude constant, no matter what. If anyone knows, it would of huge appreciation!

mathismeilby
Автор

Anyone know why the 0.2f magic number is used in the helper function? i'm trying to dissect it myself and fully understand it but i have no idea about that part there.

xavmanisdabestest
Автор

I’ve got a very simple script that adds a force in the movement direction, but I’ve added a maxSpeed float that is compared to the velocity in an if statement, and if the velocity exceeds that max speed it will simply stop applying the acceleration.

Does that sound like a good way to do it? Bear in mind I’m a very new unity user, but to me it made sense

thebulletkin
Автор

This was very helpful, but qouldn't it be better for water to use a Buoyancy effector?

penguinmonk
Автор

endlich die Wasserphysik verstanden. Danke!!!

SirSnowman
Автор

How about a 2D version of that script?

Orsovico
Автор

How is this the only tutorial that enables a kind of acceleration controlled via script & rigidbody? Thanks for the tutorial!

FBlockLeymann
Автор

Thank you so much for this video. It helped me a lot and it was exactly what i was looking for!

I have one question

I have been trying to stop an object from moving with this
if (collisioninfo.collider.tag == "obstacle")

but what do i have to put in that region to stop it from moving?

MaybeWinstonMain
Автор

Thank you for this terrific demonstration and also the helper method for maintaining a velocity. If I have a gameObject that is supposed to represent a ship or boat, do you think it best to apply the engine forces to separate gameObjects that represent the engines or should I apply the force to a relative location in the original gameObject?

ernestj
Автор

if you want to add force in local coordinates instead of using "AddForce" you can use "AddRelativeForce"

alotofclouds
Автор

its called terminal velocity when your down force and resistance even out and u cant go any faster

isaiahlewis
Автор

Please explain Force Work with wheel joint car

narayanbotre
Автор

i used the applyforcetoreachvelocity and my speed doesnt stop at 10 it just keeps increasing

irl_sonic
Автор

ok i know how to Force my game object but I have code i have 1 big problem when throw the object he goes wrong axis how I do my object to Force X axis and not to be standard left or right ? I know with y axis transform.up and for z axis transform.forward but i won't the same with X axis and I have no idea wat is the name for this
I want when rooted or flips my game object to change the point Force posion but in x axis not y or z

watercat
Автор

Hey I have a small problem, I have downloaded Visual Studio with the Unity extension so that I can attach scripts to Unity but when I code it doesnt show me the autocomplete function (ex. If i type GetC then it would not recommend me the GetComponent) How can I eneble this?

hey_therexd