Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Strange glitch? Camera Offset + collision detection

Hello everyone,

I feel like I have encountered some sort of strange glitch and I am unsure of what to do about it. I am not even sure posting it will help me but I wanted to see if anyone else has encountered it or can re create it.

I have an actor constrained to the position of the mouse on bot X and Y axis. I am working in a large scene where I can drag my camera around and I must account for the camera offset.

I am successfully accounting for that camera offset with other actors and procedures throughout my game and I am attempting to use the same procedure to make sure that this actor stays attached to my mouse outside of original screen size. It is very standard practice as far as I can tell and was working perfectly until now.

I am using a constrain to bind the actor position to mouse position plus camera position and this actor has collision rules.
Constrain self.position.x to: game.mouse.position.x + game.cameraX
repeat for Y...

As soon as I start to leave the original screen size that actor slowly starts to drift farther and farther away from the mouse pointer. The farther I am away from original screen size the farther it is away from mouse pointer and likewise the closer I am to original screen size the closer it gets.

So, I said, what the heck. I deleted the addition of the game.cameraX and Y from the above equation.

Suddenly this is working... visually... I can see it attached to the pointer no matter where I am. However, it is now only receiving its collision command if it is inside original screen size. Leave that area and collision stops working.

I have been checking and checking, debuggin and looking for something stupid that I somehow overlooked but this little set up is so simple and straight forward, I am just not finding any problems. It seems to be halfway working and half not. It works absolutely perfect inside original screen size.

The problem seems to be that the collision detection attached to this object is not working outside of the original screen size and I am wondering if this is some sort of glitch with collisions and camera offset?

Has anyone else encountered this problem and if so do you have a work around? The way that collision is set up I don't seem to have a lot of control over it. Is there some other way to account for camera offset with collisions? I feel like I already know the answer to that is, that's a stupid question, there is no collision offset needed when the rule is detecting overlap but something weird seems to be going on here.

Thanks for reading!


  • StoopieSteveStoopieSteve Posts: 9Member
    ::Extremely heavy sigh::

    I click post... I look back over at Gamesalad... stupid F'n actor is on the wrong layer (non-scroll-able)!!!!

    My apologies! The issue has been resolved.

    Moderators, you may feel free to purge this thread from existence... Or, leave it permanently etched in to the stones of eternity for your amusement. Maybe some other poor sap will save themselves hours of head scratching at my expense.
  • gyroscopegyroscope I am here.Posts: 6,577Member, Sous Chef, PRO
    edited September 2013

    Hi @StoopieSteve glad you solved it...

    Personally, I think I'll leave it "permanently etched in to the stones of eternity" not for amusement but to help any other poor sap... I mean, GSC user ;-) who might encounter the same prob. and so would benefit from the solution. :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain

This discussion has been closed.