1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

GM:S 1.4 Ragdoll Towards Mouse!

Discussion in 'Programming' started by santeri kalliomaki, Feb 11, 2018.

  1. I need to make my ragdoll move towards mouse.

    If my cursor is in right side of the ragdoll it does what I want it to do

    but if the cursor is in left side the ragdoll turns upside down. o_O

    Code of the dragdoll:

    ///CREATE RAGDOLL
    //Torso
    var Torso = instance_create(x,y,oBody_parts);
    with Torso
    {
    sprite_index = spTorso;
    event_user(0);
    global.torso = id;
    }

    //Top
    var Neck = sRagdoll(spNeck,Torso,0,-50,30,false);
    var Head = sRagdoll(spHead,Neck,0,-50-20,30,false);
    var Stomach = sRagdoll(spStomach,Torso,0,50,30,false);
    var Pelvis = sRagdoll(spPelvis,Stomach,0,50+50,30,false);

    //Arms
    var Arm_L = sRagdoll(spArm,Torso,50,-20,90,true);
    var Arm_R = sRagdoll(spArm,Torso,-50,-20,90,true);
    var Forearm_L = sRagdoll(spArm,Arm_L,50+60,-20,90,true);
    var Forearm_R = sRagdoll(spArm,Arm_R,-50-60,-20,90,true);
    var Hand_L = sRagdoll(spHand,Forearm_L,50+60+60,-20,30,true);
    var Hand_R = sRagdoll(spHand,Forearm_R,-50-60-60,-20,30,true);

    //Legs
    var Leg_L = sRagdoll(spLeg,Pelvis,20,50+50+20,90,false);
    var Leg_R = sRagdoll(spLeg,Pelvis,-20,50+50+20,90,false);
    var Shin_L = sRagdoll(spShin,Leg_L,20,50+50+20+70,90,false);
    var Shin_R = sRagdoll(spShin,Leg_R,-20,50+50+20+70,90,false);
    var Foot_L = sRagdoll(spFoot,Shin_L,20,50+50+20+70+70,90,false);
    var Foot_R = sRagdoll(spFoot,Shin_R,-20,50+50+20+70+70,90,false);

    //Change depth (Arms and Legs in front of Body)
    Arm_L.depth = -1;
    Arm_R.depth = -1;
    Forearm_L.depth = -1;
    Forearm_R.depth = -1;
    Hand_L.depth = -1;
    Hand_R.depth = -1;
    Leg_L.depth = -1;
    Leg_R.depth = -1;
    Shin_L.depth = -1;
    Shin_R.depth = -1;
    Foot_L.depth = -1;
    Foot_R.depth = -1;

    instance_destroy();

    Code of ragdoll facing direction:

    if physics_test_overlap(x, y, 0, o_box){
    phy_speed_x=0
    phy_speed_y=-10
    }

    var ldx = lengthdir_x(0, mouse_x);
    var ldy = lengthdir_y(0, mouse_y);
    with(oBody_parts)
    {
    phy_rotation = point_direction(phy_position_x,phy_position_y,mouse_x,0)
    direction = phy_rotation = 0
    image_angle=direction.x
    }

    if x < mouse_x
    image_xscale=+1
    else
    image_xscale=-1

    I think the problem is somewhere in there. Thank you for reading and hopefully helping me out! :p
     
  2. TheouAegis

    TheouAegis Member

    Joined:
    Jul 3, 2016
    Posts:
    7,143
    Because you are setting the rotation. You are rotating 180 degrees. You need to flip it instead.
     
  3. TheouAegis

    TheouAegis Member

    Joined:
    Jul 3, 2016
    Posts:
    7,143
    And what the heck is this supposed to do?
     
  4. Could you give me an example please? :)
     
  5. TheouAegis

    TheouAegis Member

    Joined:
    Jul 3, 2016
    Posts:
    7,143
    Supposedly it required rebinding the fixture. I don't know if anybody found an easy solution yet.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice