★★★ How to keep HUD in same place when camera rotates ★★★

UtopianGamesUtopianGames Member Posts: 5,692
edited November -1 in Working with GS (Mac)
Had a lot of mails about this so decided to do a quick video to show you how to keep you HUD in the same position while rotating camera.

The trick is to use 2 actors one that has the rules for touch alpha 0 because this doesnt move and another visual actor that moves around with the camera.



Darren.

image

Comments

  • CPGAPPSCPGAPPS Member Posts: 9
    How could we make this work with the scene camera rotating clockwise or counter clockwise? My game has the scene camera rotating continuously. I cant seem to figure out how to LOCK the HUD from moving.
  • old_kipperold_kipper Member Posts: 1,420
    All elements of the HUD need to be offset from the centre rotational point of the camera and constrained to the rotation of the camera. Check the 'free yourself from the tyranny of centre rotation' thread for how to do the offset and then use the constraint for the angle.
  • CPGAPPSCPGAPPS Member Posts: 9
    Thanks old_kipper! Really appreciate the help!
  • old_kipperold_kipper Member Posts: 1,420
    P.s I think you will have to use custom fonts if you have a score visible in the HUD as the in game fonts don't rotate (I if remember correctly)... And try to keep the number of HUD elements down as the movement can lag sometimes especially with the current version of GS. Mine are doing a bit of jittering but were fine in the last version. Hopefully this will improve in the next update. One trick is to have a single object for most of the graphics that is centred on the camera and just rotate it then for changing graphics use the offset rotation method. There is a performance hit with displaying everything through a largely blank image which I suppose has to do with some calc of the images through levels to display to screen, but it may be less than the constrain of multi images for the HUD. I noticed this with in tests of stacking large images...
  • CPGAPPSCPGAPPS Member Posts: 9
    Thanks a lot old_kipper for the details. I am already planning on having custom fonts for the scoring. I have 4 elements to my HUD. (Jump, Score, Menu and Time) If i run into any issues I will be dropping the time countdown first. I am eager to try out what the forum notes. I will keep you updated. Thanks again.
  • CPGAPPSCPGAPPS Member Posts: 9
    HEY! So I got the HUD (Green Box) to constrain but when I try to have the actor move through out the scene, the HUD moves off. How would I go about constraining the HUD with the control of the camera? Here is the 2 movies. The first is the HUD working great with the rotation stationary. The other movie is with the PINK actor moving. Watch as the Green box moves off screen.



Sign In or Register to comment.