Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing SKPhysicsBody parameters doesn't have effect

I try to simulate behavior of different types of balls (football ball, tennis, golf, volleyball etc). For these purposes I tried to change density, mass, size parameters of the physics body. In my game it doesn't have effect and I tried to simulate it in very simple app consists from ball and paddle

enter image description here

the ball always rises to the same height with the same speed regardless of mass, density, size

setting for the ball

enter image description here

Is this because of restitution equals 1? How can I simulate behavior of different ball types in this way?

like image 638
ira_ira Avatar asked Jul 16 '17 13:07

ira_ira


1 Answers

you need to change the restitution property as well as the Lin. Dampening and Ang. Dampening per ball

for my example i have

tennis ball - rest 0.6 lin 0.2 ang 0.2

soccer ball - rest. 0.5 lin 0.3 ang 0.2

golf ball - rest 0.8 lin 0.3 ang 0.3

shot put - rest 0.1 lin 0.1 ang 0.1

enter image description here

here is a link to the Apple definitions of the properties

https://developer.apple.com/documentation/spritekit/skphysicsbody/1519906-mass

like image 143
Ron Myschuk Avatar answered Nov 04 '22 23:11

Ron Myschuk