Platypus and raycasts collisions

Hello,

I’m trying Platypus which i’ve found nice for platformers.

I have several questions about collisions:

  1. As the collisions are stored in config.collisions, i think it’s ok to change during game the values of the rays ? For example, when the hero draws his sword, horizontal values should be changed.

  2. can we have several collisions rays (one for the head, and one for the body). In the sources, i have seen that collisions shapes were not possible.

  3. if game object is rotated, will it be inherited by the collision box ? Or is it possible to rotate the collision box by hand (see question 1 ) ?

Thank you.

I have experimented a bit, and i think it’s not possible to change rays collisions on the fly. The collisions are stored in local variables in platypus module after call to the initialisation function.

And rotating the game object doesn’t rotate the « ray-box », but that’s not a problem for a sprite climbing a slope, because with the diagonals rays, you can manage the thing. (won’t work if the sprite rotate too much, for example when swimming).

I wonder how to do for collision box when the player is squatting. If a projectile flies above the visible crouched sprite, it can still touch the ray-box… that’s why it would be interesting to have modification on the fly of the rays length of platypus module. Is there a reason why there is not a getter/setter on them ? May be i have miss something ?

Thank you.

1 Like

This is something that could be added to Platypus. Please open a ticket on GitHub!

3 Likes

I’ve tried to do the modification myself, and added a very simple sample for showing it: https://github.com/britzl/platypus/pull/24

Hope it will help and avoid you extra-work ^^’ (not sure about the later, but i’ve tried my best).

Thank you for the contribution! I have requested a couple of changes before I can merge it.

1 Like

Ok, it’s done. It seems that the changes have been automatically added to the discussion when i pushed to my branch. So i think i have nothing more to do, for you to see them ?

1 Like