File tree 1 file changed +28
-3
lines changed
1 file changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -617,9 +617,34 @@ void Attachment::updateGraphics(float dt)
617
617
World::getWorld ()->getTicksSinceStart ()) / 0 .7f ;
618
618
if (scale_ratio > 0 .0f )
619
619
{
620
- float scale = 0 .3f * scale_ratio +
621
- wanted_node_scale * (1 .0f - scale_ratio);
622
- m_node->setScale (core::vector3df (scale, scale, scale));
620
+ if (m_type == ATTACH_PARACHUTE)
621
+ {
622
+ const float progress = 1 .0f - scale_ratio;
623
+
624
+ const float x = 0 .2f * atan (25 .0f * progress - 5 .0f ) + 0 .69f ;
625
+ const float y = x;
626
+ const float z = 1 .0f - pow (2 .0f , -20 .f * progress);
627
+
628
+ m_node->setScale (core::vector3df (x * wanted_node_scale,
629
+ y * wanted_node_scale,
630
+ z * wanted_node_scale));
631
+ }
632
+ else
633
+ {
634
+ if (is_shield)
635
+ {
636
+ // Taken from https://easings.net/#easeInElastic
637
+ const float c4 = (2 .0f * PI) / 3 .0f ;
638
+ const float x = scale_ratio;
639
+
640
+ scale_ratio = x <= 0 ? 0 : x >= 1 ? 1
641
+ : -pow (2 , 10 * x - 10 ) * sin ((x * 10 - 10.75 ) * c4);
642
+ }
643
+
644
+ float scale = 0 .3f * scale_ratio +
645
+ wanted_node_scale * (1 .0f - scale_ratio);
646
+ m_node->setScale (core::vector3df (scale, scale, scale));
647
+ }
623
648
}
624
649
else
625
650
{
You can’t perform that action at this time.
0 commit comments