EricPB
Member
Here is a problem, I am trying to make a physics based game for GMS2. As such I enabled physics for the one test room I have and the appropriate objects, and try to set up the camera.
The problem comes that when I have the rooms boxed ticked off as using physics, the camera doesnt display the room properly- i only see the background color. Either because it is so far off the rooms center or the room doesnt display properly. However, when I untick the using physics box for the room, the camera works fine but none of my physics objects work, obviously.
What the heckie is going on?
I only have two objects in my game, the player and the walls - its top down. The use viewports is ticked, both objects are ticked off as physics objects.
Create code for camera
Step Code for camera
UPDATE
The instance does not have an associated physics representation
at gml_Object_obj_player_Step_0 (line 16) - physics_apply_local_force (0,32,-10,0);
#######################################################################
if i have the physics turned off to make the camera work, this is the error i get for the physics object
The problem comes that when I have the rooms boxed ticked off as using physics, the camera doesnt display the room properly- i only see the background color. Either because it is so far off the rooms center or the room doesnt display properly. However, when I untick the using physics box for the room, the camera works fine but none of my physics objects work, obviously.
What the heckie is going on?
I only have two objects in my game, the player and the walls - its top down. The use viewports is ticked, both objects are ticked off as physics objects.
Create code for camera
Code:
/// @description Set Up Camera
cam = view_camera[0];
follow = obj_player;
view_w_half = camera_get_view_width(cam) * 0.5;
view_h_half = camera_get_view_height(cam) * 0.5;
xTo = xstart;
yTo = ystart;
Code:
//Update Destionation
if (instance_exists(follow))
{
xTo = follow.x;
yTo = follow.y;
}
//Update Object Position
x += (xTo - x) / 25;
y += (yTo - y) / 25;
//Update Camera View
camera_set_view_pos(cam,x-view_w_half,y-view_h_half);
The instance does not have an associated physics representation
at gml_Object_obj_player_Step_0 (line 16) - physics_apply_local_force (0,32,-10,0);
#######################################################################
if i have the physics turned off to make the camera work, this is the error i get for the physics object
Last edited: