GameSalad

Howdy, Stranger!

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

Dragging objects when scene size is larger than screen size

jrj.clarkjrj.clark Posts: 17Member, PRO

Hi there,

I want to move touch an object and drag it around the screen. This is fairly easy: just constrain x and y to touch x and y.

However, the scene height is twice the screen height. Therefore, if I touch an object when the screen is showing any of the upper half, 'touch y' registers the touch in relation to the screen, not the scene. As a result, when I touch an object it jumps further down the screen to the 'correct' scene y position. I know I need to offset for the camera location, but this is an object that will spawn into the game so I can't unlock the behaviours for the object in the scene.

Any ideas on how I can resolve this?
Thanks

Comments

  • SocksSocks London, UK.Posts: 12,822Member

    Add camera origin x and camera origin y to your constrain x and y.

  • jrj.clarkjrj.clark Posts: 17Member, PRO

    I thought it wasn't possible to add 'camera origin' to the prototype actor? I can't find it listed. My actors aren't starting off in the scene, instead they are spawning into the scene.

  • SocksSocks London, UK.Posts: 12,822Member

    @jrj.clark said:
    My actors aren't starting off in the scene, instead they are spawning into the scene.

    Use Game.attributes to apply the camera origin offset.

Sign In or Register to comment.