Lock object on image point

0 favourites
  • 12 posts
From the Asset Store
Connect the dots in the correct order and draw happy animals!
  • Had to start another thread since my turret arm system keeps giving me problems. I'm trying to create a system where the player's arm is seperate from rest of the body. I made an event where the arm sets its position to the body's image point 1 at every tick, but somehow the arm keeps lagging behind as if I added a lerp effect to it. I've checked many times that I hadn't done any lerping to its position, so I don't know why the arm keeps lagging.

    Basically all I'm doing is using a condition "every tick" and an event "Set position to Player_Sprite image point 1"

    I'm sorry if this is confusing. My project is rather large and full of holes currently so I can't really share it with you guys.

  • Can't do much more than throw guesses at ya with only this much info to go on.

    Is the sprite and/or the arm animated? if so, are the image points changing with the animations?

    How's your framerate? Could it just be lag?

    Why not use pin behavior?

  • The image point does move on every frame on running/jumping animations etc. The arm is not animated except when firing, but its own origin does not move. This should not cause lag like that. Framerate is a constant smooth 60 FPS. Can I pin objects to image points? I need to pin it to image points and not the origin point because otherwise the arm would look floaty and seperate from the character.

  • have you tried it without the image point moving every frame? that might have something to do with it. you can pin it in the position of the image point, but not actually to the image point (I think), so it won't follow a changing image point. Really can't help much without seeing it firsthand.. Maybe open a separate project with the minimal pieces and see if you can pinpoint the problem and if not, share with us the new project capx and we'll do our best!

  • Perhaps you're positioning the arm before the events that move the body. You should put your events that position the arm after the events that move the body. If the events that move the body are after the arm events, then it will look like it is lagging because the arm would be positioning itself to the previous body position and not the current position.

  • have you tried it without the image point moving every frame? that might have something to do with it. you can pin it in the position of the image point, but not actually to the image point (I think), so it won't follow a changing image point. Really can't help much without seeing it firsthand.. Maybe open a separate project with the minimal pieces and see if you can pinpoint the problem and if not, share with us the new project capx and we'll do our best!

    I did remake the system on a blank file and the problem was solved. It must has to have something to do with the turret's constant changing of angle. The gun turns to face the direction you move into, so it's constantly rotating with a lerp effect. I've tried disabling as many conditions as possible but the problem just won't go away. I'll play around more today. Maybe there's something very obvious I'm just missing.

    Perhaps you're positioning the arm before the events that move the body. You should put your events that position the arm after the events that move the body. If the events that move the body are after the arm events, then it will look like it is lagging because the arm would be positioning itself to the previous body position and not the current position.

    I've tried putting the event to the very top and bottom of the event sheet but it's not changing.

    This is just so weird because the arm keeps lagging behind and looks like I've added some kind of lerping to it even if I haven't. Setting the object's position on every tic should logically make it work, but there's something more technical going on that's causing this.

  • Alright, double post, but I think I found a bug in the system. I recreated the player objects from my project into a blank project once again and this time the same problem arise. In my problem the player is built from a hitbox with platform controls, player's sprite on top of and pinned to that hitbox and then the gun set to the sprite's image point. This somehow causes the gun to lag. If I set it to the actual hitbox's image point there won't be any problems.

    I might be explaining things in a bit confusing way, so check the project out for yourself: https://dl.dropboxusercontent.com/u/505 ... tlock.capx

    Does this seem like an oversight from the devs? Or is there something I'm doing wrong? If someone feels like fixing this, keep in mind that setting the arm object to the blue object is vital. I can't set it to the red box and make it look good with the player's animations. That's just how my game is built.

  • If you disable the pin and set Sprite2 position and then Sprite3 position it's fixed. I would guess Pin sets the position after the events so it lags one tick behind. I think this was what Prominent meant.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Aha! That did the trick! And here I was thinking that I've found a serious bug in the system. Great, now I can get back to devving without having to watch a floaty rubber arm dangling behind my character

  • If you disable the pin and set Sprite2 position and then Sprite3 position it's fixed. I would guess Pin sets the position after the events so it lags one tick behind. I think this was what Prominent meant.

    You sir, you are awesome. Thank you soooooo much!

  • I figured out a solution. just make every limb outward a sub-event, because technically every limb is a sub-position. Helps significantly with organization too. This has only worked for set position. Pinning is "one-event." Don't know if you can get it to work.

  • Whoa, thats hell of a thread necro!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)