|
Post by Admin on Jul 30, 2017 5:32:43 GMT
Hello All,
Im working on a simple (relatively) project where the background rotates around the character. I have that part working fine; however, the blocking volumes I’m using are rotating around their own origin points, creating a propeller effect for each blocking volume. Any ideas on how I could set their rotation point to a unified point so they spin in unison with each other, preserving the map layout?
|
|
|
Post by Admin on Jul 30, 2017 5:33:58 GMT
** By _M_S_D_ ** So it’s like a top down project where player movement rotates the entire world instead of the player? Sort of like super probotector on the top down levels? If so: Each entity gets it’s own center around which it rotates when using SetAngle(). This means they all rotate individually around their own center. This is unavoidable as all entities get it’s own center in the editor (sort of a center relative itself). So to get the desired effect (if I understood correctly) you will need to change the center of each entity to match the center of the background. To achieve this I think SetPivotAdjust() is the way to go. Setting the vector2 to the same position as the background center on all entities should then make all of them gravitate around that point and make the world rotate accordingly. I have not tried this myself so I’m not sure as to how it works or if it works even. But I think it should. Tell me how it goes!
|
|
|
Post by Admin on Jul 30, 2017 5:35:06 GMT
** By jlynes **
Thanks for the advice _M_S_D_, however in addition to offsetting the rotation point like needed, it also offset the sprites themselves, and as for the collision boxes…they moved somewhere else entirely, but are still colliding with the play character. I’ll post a video a bit later today showing what’s happening if I cant figure this out.
As for the level design, its more of a vertical scroller with the player spinning the world to avoid obstacles instead of moving the player. Only other way I can think of doing this would be to rotate the camera with the player, so I’m going to give that a try first.
|
|
|
Post by Admin on Jul 30, 2017 5:35:58 GMT
** By jlynes **
I found a solution; it is not ideal, but it works.
Basically, Every collision volume will have an image the size of the main background tile and then I adjust the collision box to the size of just the volume. . This gives the volume the same rotation center as the rest of the map and keeps the collision detection where it needs to be. I’m hoping since most of the image size is transparent pixels, that it wont create to much of a performance hit.
|
|
|
Post by Admin on Jul 30, 2017 5:37:05 GMT
** By _M_S_D_ ** Ahh, that is strange. It does say in the API that pivot is normally set in the editor so I guess the functionality you were after just isn’t there. I would suppose the performance is very much dependent on how many of these layers you end up needing and whether you are using lights and other performance taxing features. Glad you managed to fix it! Usually doesn’t matter how it works as long as it works well.
|
|