Buoyancy with Unity Rigidbodies - Part 1 / Planar Buoyancy

Buoyancy with Unity Rigidbodies - Part 1 / Planar Buoyancy

V.A. - Indie Dev

3 года назад

45,682 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

min yunu
min yunu - 01.02.2023 16:40

Thank you!!!!!!

Ответить
mautlej
mautlej - 13.11.2022 19:29

Thank you

Ответить
Dmitriy Batkovich
Dmitriy Batkovich - 02.10.2022 22:39

Thank you, the tutorial helped a lot!

Ответить
itsuki uehara
itsuki uehara - 24.07.2022 08:50

subscribed cus you rock!

Ответить
catscatscatscats
catscatscatscats - 06.07.2022 18:55

how is your sky that color?

Ответить
Erodon
Erodon - 03.06.2022 00:05

great video ! thanks <#

Ответить
matus
matus - 02.06.2022 19:59

the object does not float for me :(

Ответить
LearnWithArjun
LearnWithArjun - 01.05.2022 07:36

Can u plsssssssssssssssssssssssssss give a link for the project?

Ответить
LearnWithArjun
LearnWithArjun - 01.05.2022 07:36

Can u plsssssssssssssssssssssssssss give a link for the project?

Ответить
LearnWithArjun
LearnWithArjun - 01.05.2022 07:36

Can u plsssssssssssssssssssssssssss give a link for the project?

Ответить
kyle789XBL
kyle789XBL - 29.03.2022 00:20

public Transform[] Floaters;
public float UnderWaterDrag = 3f;
public float UnderWaterAngularDrag = 1f;
public float AirDrag = 0f;
public float AirAngularDrag = 0.05f;
public float FloatingPower = 15f;
public float WaterHeight = 0f;

Rigidbody Rb;
bool Underwater;
int FloatersUnderWater;
// Start is called before the first frame update
void Start()
{
Rb = this.GetComponent<Rigidbody>();
}

// Update is called once per frame
void FixedUpdate()
{
FloatersUnderWater = 0;
for(int i = 0; i < Floaters.Length; i++)
{
float diff = Floaters[i].position.y - WaterHeight;
if (diff < 0)
{
Rb.AddForceAtPosition(Vector3.up * FloatingPower * Mathf.Abs(diff), Floaters[i].position, ForceMode.Force);
FloatersUnderWater += 1;
if (!Underwater)
{
Underwater = true;
SwitchState(true);
}
}
}
if (Underwater && FloatersUnderWater==0)
{
Underwater = false;
SwitchState(false);
}
}
void SwitchState(bool isUnderwater)
{
if (isUnderwater)
{
Rb.drag = UnderWaterDrag;
Rb.angularDrag = UnderWaterAngularDrag;
}
else
{
Rb.drag = AirDrag;
Rb.angularDrag = AirAngularDrag;
}
}

Ответить
ShadowArtz99
ShadowArtz99 - 06.03.2022 16:02

hey really good tutorials, quick question how would i go about limiting the physics to only work when inside the water plane? because ive noticed that moving the plane up or down doesnt change anything about the simulation.

Ответить
Giyhome
Giyhome - 02.03.2022 23:39

you should make a link to have the code

Ответить
張覲顯
張覲顯 - 08.02.2022 18:12

nice this helped me a lot thanks your teaching

Ответить
Kyle Gerald Bagtas
Kyle Gerald Bagtas - 12.01.2022 13:00

Noice

Ответить
nicolas rafano
nicolas rafano - 04.01.2022 18:21

🔥🔥🔥

Ответить
ItsTommy0
ItsTommy0 - 14.12.2021 13:08

Is there a link for the project please?

Ответить
Gamedev Inspire
Gamedev Inspire - 25.11.2021 12:47

so much thanks for these tutorials,however i didnt really need it becausei have my own solution but i thank you agian for creating these tuts for more people out there,you deserve more subscribers and views.

Ответить
noobis sk
noobis sk - 05.11.2021 21:15

Really thanks, i needed help with that!

Ответить
Raven Minis
Raven Minis - 04.10.2021 22:53

why do you make public floats instead of serializing private floats? Just curious

Ответить
uuu uuu
uuu uuu - 11.09.2021 20:27

Goodgoodgoood!

Ответить
Oscar Cerro
Oscar Cerro - 05.07.2021 02:35

Gold, Nothing more to say

Ответить
bmaz bmaz
bmaz bmaz - 02.07.2021 15:00

thanks man
👍

Ответить
Damir Shabayev
Damir Shabayev - 28.06.2021 09:49

can someone help me my shipS all flip over

Ответить
Steven Xie
Steven Xie - 06.05.2021 04:08

Thank you

Ответить
GrevMivlos
GrevMivlos - 01.05.2021 12:44

Very cool - thank you

Ответить
OnkAnCa64
OnkAnCa64 - 30.04.2021 19:45

Thanks, can you make or do you have an example of a shader made with shader graph on HDRP to manage vertex displacement using a heightmap? thx in advance

Ответить
Michael McVeigh
Michael McVeigh - 30.04.2021 18:54

Thank you!

Ответить