Camera Position Problem
betazero
Member Posts: 39
I have tried several ways but here is my problem. I constrain the camera to the x & y mouse position ( my actors position is also constrained to the x & y mouse position ) but once my actor gets to about 240,160, the position of the mouse (finger) starts offsetting from where the actor is. It works fine in the editable preview , but not when it just shows the 480,320 view. Also the iphone preview is messed up. What am I doing wrong? I tried using the accelerometer to move the camera but I have the same problem.
Comments
By the way to the developers of GameSalad...Thank you Soooooooooooo much!!!! I have all these game ideas stuck in my head and now I can get them out!
Here I posted a quick example of the problem. Move the actor to the right. Once it starts to pan the mouse runs away from the actor.
http://gamesalad.com/game/play/35790
The mouse runs away because it is moving in your desktop. Add an actor (and an instance of it in the scene) that uses only the "display text" behavior to display "device.mouse.x". Now place the Orange actor (Actor 1) so the instance in the scene has an X position of 0 (it should be halfway on the left edge). Then "Preview". You will see as you move right from the left side of the preview window (where the mouse X values start at 0) that when you get to the right edge of the preview window, the mouse X position is 480 (the width of the window). Then as you move further right past the right edge you approach 960 (the width of the scene). As you hit 960, your mouse pointer will be as far away from the right edge as the width of the window (i.e. your mouse truly traveled 960 pixels). However, since the Orange actor is limited to the camera view, the last 480 pixels scroll past leaving the Orange actor "in place" relative to the camera view.
It is kind of an optical illusion...more of a logic illusion if you will. You may be able to scale the mouse movement but then you may lose some precision in movement.
edit - Actually it goes off center at 272 pixels...even weirder number.
edit - The 272 changes as I change the camera constraint box.
Then you will see it scroll from 0 to 479 and then 480 to 959+ as you scroll out of the camera view/game window.
cya and thanks for helping.
http://gamesalad.com/game/play/36003
http://gamesalad.com/wiki/how_tos:gsc_drag_and_drop_movement#modifications_for_non-default_scene_size