• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Android Camera position in relation with object

C

Constant

Guest
Hello,

I am struggeling with positioning a camera in front of an object.
In a room I create one object (my_obj) and a camera (obj_cam).

my_obj should be in the center of the room.
obj_cam should be in one line with my_obj.
_______________
| |
| |
| |
| |
| |
| my_obj |
| |
| |
| |
| |
| |
| obj_cam |
_____ ______

To position my_obj in the center of the room I use in my_obj_Create:
my_obj.x = room_width/2;
my_obj.y = room_height/2;

To position obj_cam in front of my_obj I have to use in obj_cam_Draw:
d3d_set_projection(xfrom, yfrom, zfrom, xto, yto, zto, xup, yup, zup)

Somehow I don't succeed in doing this.
- I am not able to find the correct values for d3d_set_projection
- I have problem with the distance between obj_cam en my_obj
- I cannot put the camera in front of my_obj and in one line towards my_obj
- How are my_obj.x en my_obj.y related to obj_cam?

Can somebody help me.
It seems so simple but for me it's not.

Thanks in advance.

Regards,
Tnatsnoc
 
Top