@@ -54,7 +54,7 @@ public function __construct(
5454 $ this ->position = $ origin ->clone ();
5555 $ this ->lastEventPosition = $ origin ->clone ();
5656 $ this ->floorCandidate = $ origin ->clone ();
57- $ this ->ball = new BallCollider ($ this ->world , $ origin , $ radius );
57+ $ this ->ball = new BallCollider ($ this ->world , $ origin , $ radius, $ this -> angleHorizontal , $ this -> angleVertical );
5858 $ this ->needsToLandOnFloor = !($ this ->item instanceof Flashbang || $ this ->item instanceof HighExplosive);
5959 $ this ->timeIncrement = 1 / $ this ->timeMsToTick (150 ); // fixme some good value or velocity or gravity :)
6060 $ this ->tickMax = $ this ->getTickId () + $ this ->timeMsToTick ($ this ->needsToLandOnFloor ? 99999 : 1200 );
@@ -145,17 +145,20 @@ public function process(int $tick): void
145145 $ pos ->z = $ z ;
146146 }
147147
148- if (!$ this ->ball ->hasCollision ($ pos, $ this -> angleHorizontal , $ this -> angleVertical )) {
148+ if (!$ this ->ball ->hasCollision ($ pos )) {
149149 continue ;
150150 }
151151
152- if ($ this ->ball ->getResolutionAngleVertical () > 0
153- && $ this ->world ->findFloorSquare ($ this ->floorCandidate ->set ($ pos ->x , $ pos ->y - $ this ->radius , $ pos ->z ), $ this ->radius )) {
152+ if (
153+ $ this ->ball ->getResolutionAngleVertical () > 0
154+ && ($ this ->item instanceof Flammable || $ this ->item instanceof Smoke)
155+ && $ this ->world ->findFloorSquare ($ this ->floorCandidate ->set ($ pos ->x , $ pos ->y - $ this ->radius , $ pos ->z ), $ this ->radius )
156+ ) {
154157 if ($ this ->item instanceof Flammable) {
155158 $ this ->finishLanding ($ pos );
156159 return ;
157160 }
158- if ($ this ->item instanceof Smoke && $ this -> world ->isCollisionWithMolotov ($ this ->floorCandidate )) {
161+ if ($ this ->world ->isCollisionWithMolotov ($ this ->floorCandidate )) {
159162 $ this ->finishLanding ($ pos );
160163 return ;
161164 }
@@ -201,9 +204,6 @@ public function applyRecoil(float $offsetHorizontal, float $offsetVertical): voi
201204 public function setAngles (float $ angleHorizontal , float $ angleVertical ): void
202205 {
203206 $ this ->angleHorizontal = $ angleHorizontal ;
204- if ($ angleVertical < 0 ) {
205- $ angleVertical /= 2 ;
206- }
207207 $ this ->angleVertical = $ angleVertical ;
208208 }
209209
0 commit comments