Can't change Bullet Angle while Speed = 0

Bugs will be moved here once resolved.

Post » Tue Jun 19, 2012 6:53 pm


Hi,

I created a maze-like setup while Rings with Bullet behaviour are supposed to run around randomly.
To handle the collisions with Walls, whenever a Ring collides with a Wall object, I ask it to set Bullet Speed to 0, then back a pixel (so it is not colliding with Wall anymore), then add a value to its current Bullet.AngleOfMotion. This added angle is a random of +90, -90, 180.
Then I set the Bullet Speed back to normal speed.

What I believe to be a bug is: If I leave things in the order described above, the Rings only go left and right and left and right whenever colliding with walls.
If I invert the order of the Bullet Behaviour actions, it works properly. I mean, it works properly if, after setting Speed to 0 and snapping the Ring back a pixel further from the wall, I set the Bullet Speed to normal speed and THEN ask the Bullet Angle to be added a random angle.
Then, the Rings correctly choose random angles and go up/down/left/right randomly when colliding with Walls.




B
10
S
2
G
3
Posts: 28
Reputation: 2,690

Post » Tue Jun 19, 2012 7:02 pm

This has been reported a few times, but it really only makes sense the way around when you say "set speed" then "set angle of motion". When the speed is 0, it is not moving at all, let alone in any particular direction. It's to do with how the bullet calculates its movement internally. Does that make sense?
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Wed Jun 20, 2012 6:20 pm


Yes it does make sense, I guess the angle is based on current speed vector or something like that?
If that is the case, maybe you could set a "ghost" angle based on an always-on zero angle fake speed vector?

B
10
S
2
G
3
Posts: 28
Reputation: 2,690


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 2 guests